-
Notifications
You must be signed in to change notification settings - Fork 80
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
XRENDERING-764: Add an option for messages to be set as status #319
base: master
Are you sure you want to change the base?
Conversation
* Created a class for the parameters specific to message macros (right now, only the new `isActive` * Used this new parameter in the macro execution to change the result accordingly. * Updated tests to fit the new method requirements.
* Fix on feature, I mixed things up earlier.
* Corrected typo
* Added the `advanced` flag to the property. This way it gets displayed with a lower priority in the CKEditor macro editor.
|
||
/** | ||
* @since 17.0.0RC1 | ||
* @return whether or not the current message is a status. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might need some more documentation on what exactly a "status" is and why would one set that to true
.
You need to add translation keys for all those new parameters (yes, you added only one, but each macro which expose |
/** | ||
* @see #isStatus() | ||
*/ | ||
private boolean isStatus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the getter is isStatus
, the field name is generally expected to be status
.
* @since 17.0.0RC1 | ||
* @param isStatus refers to {@link #isStatus()} | ||
*/ | ||
@PropertyDescription("Whether or not this message should be announced as a status.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a much better description as otherwise users will be completely lost when this flag should be set. The description should clearly explain what consequences this has and when it should be used. Also, I'm wondering if it could make sense to more generically expose a "role" parameter - or is it clear that there is no other role that could be interesting?
* | ||
* @version $Id$ | ||
* @since 17.0.0RC1 | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the whole class should be marked as @Unstable
. Further, macro parameter classes normally aren't internal in XWiki.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, macro parameters being APIs, it's safer to put them under revapi scrutiny.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Thomas said, translation keys are missing. Further, you should add least one or two tests that verify that the new parameter works as expected. Apart from this and the other small comments, this looks good, thank you for taking care of this!
throws MacroExecutionException | ||
{ | ||
List<Block> boxFoundation = super.execute(parameters, content, context); | ||
if (!boxFoundation.isEmpty() && getIconName() != null) { | ||
Block defaultBox = boxFoundation.get(0); | ||
if (parameters.isStatus()) { | ||
defaultBox.setParameter("role", "status"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this parameter only used when the icon name is set?
Jira URL
https://jira.xwiki.org/browse/XRENDERING-764
Changes
Description
isActive
Clarifications
more
section. We set the new property asAdvanced
, so that it would only be displayed when it is set as True.Screenshots & Video
2024-12-02.16-40-15.mp4
In this video, we can see multiple uses of the info macro, with the status property set as true or left as false. Everything behaves as expected.
Executed Tests
Built the rendering module with:
mvn clean install -f xwiki-rendering-macros/xwiki-rendering-macro-message/ -Pquality
.Manual tests with a local instance (see video above).
This PR should not change the default behaviour of the message macros (this added an option but actually never used this option). The only change in UI that could break some tests is the addition of a field in the CKEditor macro editor. This is the last field, so I highly doubt this would break any xpath even if there were some poorly defined ones.
Expected merging strategy