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

feat: Add OCP interface to format richtext into string #48137

Merged
merged 4 commits into from
Sep 18, 2024

Conversation

come-nc
Copy link
Contributor

@come-nc come-nc commented Sep 17, 2024

  • Resolves: #

Summary

Adds an interface into OCP to format richtext into a string, fixing a code duplication from activity, notifications and setupchecks.
Solves this TODO:

* @TODO move this method to a common service used by notifications, activity and this command

Checklist

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
@come-nc come-nc added enhancement 3. to review Waiting for reviews pending documentation This pull request needs an associated documentation update labels Sep 17, 2024
@come-nc come-nc added this to the Nextcloud 31 milestone Sep 17, 2024
@come-nc come-nc requested review from nickvergessen, susnux and a team September 17, 2024 12:00
@come-nc come-nc self-assigned this Sep 17, 2024
@come-nc come-nc requested review from artonge, provokateurin and sorbaugh and removed request for a team September 17, 2024 12:00
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Copy link
Member

@provokateurin provokateurin left a comment

Choose a reason for hiding this comment

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

Nice one 👍

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
$replacements = [];
foreach ($parameters as $placeholder => $parameter) {
$placeholders[] = '{' . $placeholder . '}';
foreach (['name','type'] as $requiredField) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
foreach (['name','type'] as $requiredField) {
foreach (['name', 'type'] as $requiredField) {

Copy link
Contributor

Choose a reason for hiding this comment

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

why is this not covered by cs-fixed? 👀

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Why would it be broken?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because this change is not flagged an cs error

Copy link
Member

Choose a reason for hiding this comment

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

But do we have a rule for this?
The code @nickvergessen mentioned is only there to ignore git-ignored files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an array, not a function call so a space is not expected there I think

Copy link
Member

Choose a reason for hiding this comment

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

But I agree that we should have a rule for it.

/**
* @since 31.0.0
* @param string $message
* @param array<string,array<string,string>> $parameters
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @param array<string,array<string,string>> $parameters
* @param array<string, array<string, string>> $parameters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’m always afraid to break tools by doing that because the type and the name of the parameter is space separated to adding space in the type looks wrong.

@nickvergessen
Copy link
Member

Otherwise good and looking forward to it

@come-nc come-nc merged commit 989d708 into master Sep 18, 2024
174 checks passed
@come-nc come-nc deleted the enh/add-rich-object-formatter branch September 18, 2024 16:59
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 enhancement pending documentation This pull request needs an associated documentation update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants