Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Deprecate OC_Template, add proper template manager instead #51029

Merged
merged 10 commits into from
Mar 10, 2025

Conversation

come-nc
Copy link
Contributor

@come-nc come-nc commented Feb 25, 2025

Summary

Adds a proper manager with an interface for templates.
Deprecate legacy OC_Template as well as \OCP\Template class which was used as a public constructor.

TODO

  • ITemplate interface with needed methods
  • Remove all calls to OC_Template
  • Remove all calls to OCP\Template
  • follow-up: figure out what to do helper methods/functions
  • cleanup horrible TemplateLayout
  • follow-up: move OC_Util::scripts/styles/headers to template manager

Checklist

@come-nc come-nc added the 2. developing Work in progress label Feb 25, 2025
@come-nc come-nc self-assigned this Feb 25, 2025
@come-nc come-nc force-pushed the fix/deprecate-oc-template-and-cleanup branch from 0573048 to ddc5106 Compare February 27, 2025 13:05
@susnux susnux added this to the Nextcloud 32 milestone Mar 2, 2025
@come-nc come-nc force-pushed the fix/deprecate-oc-template-and-cleanup branch 3 times, most recently from 8d9a88c to 960b2b5 Compare March 3, 2025 13:34
@come-nc come-nc marked this pull request as ready for review March 3, 2025 13:54
@come-nc come-nc added 3. to review Waiting for reviews pending documentation This pull request needs an associated documentation update and removed 2. developing Work in progress labels Mar 3, 2025
@come-nc
Copy link
Contributor Author

come-nc commented Mar 3, 2025

CI failure unrelated

@come-nc come-nc requested review from susnux and provokateurin March 3, 2025 17:16
@provokateurin
Copy link
Member

Eh I started commenting on the first commit, but then saw you cleaned up stuff in the other commits. Would it be better to just review the entire diff at once instead of commit-by-commit?

@come-nc
Copy link
Contributor Author

come-nc commented Mar 4, 2025

Eh I started commenting on the first commit, but then saw you cleaned up stuff in the other commits. Would it be better to just review the entire diff at once instead of commit-by-commit?

Hum, maybe use the range commit feature to still review the change to API first, and the call changes and templatelayout changes on their own after?

@come-nc come-nc requested a review from a team as a code owner March 6, 2025 14:48
@come-nc come-nc requested review from ArtificialOwl and artonge and removed request for a team March 6, 2025 14:48
come-nc added 5 commits March 6, 2025 15:49
It is not needed anymore since OCP\Util::addScript is used directly now,
 and not the function "script" from template functions.

Signed-off-by: Côme Chilliet <[email protected]>
@come-nc come-nc force-pushed the fix/deprecate-oc-template-and-cleanup branch from bc37c9b to b086f10 Compare March 6, 2025 14:49
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

*
* @param IUser $user
* @return Template
* @since 32.0.0 Broader return type ITemplate instead of \OCP\Template.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a nice way forward without breakage 👏

interface ITemplate {
/**
* Process the template
* @since 32.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: return value could be documented. I'm assuming it's the template HTML

Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is so much cleaner 🚀

@miaulalala miaulalala removed their request for review March 10, 2025 13:06
@come-nc come-nc merged commit eb59791 into master Mar 10, 2025
190 checks passed
@come-nc come-nc deleted the fix/deprecate-oc-template-and-cleanup branch March 10, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews pending documentation This pull request needs an associated documentation update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants