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

XWIKI-17966: Mention events should display the name of the wiki where they took place in Notifications #3042

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Sereza7
Copy link
Contributor

@Sereza7 Sereza7 commented Apr 4, 2024

Jira URL

https://jira.xwiki.org/browse/XWIKI-17966

Changes

Description

  • Added a wiki indicator to mention notifications similar to the one found in regular notifications in notification/macros.vm

Clarifications

Screenshots & Video

Before the PR, there was no indication about the wiki in mention notifications (see examples on the jira ticket).
Here are two screenshots of my test instance after the PR. On this instance, I used a default user account to ping the Administrator on both the main wiki (prettyName = Home) and a sub wiki (prettyName = subwiki)
The first one shows mention notifications as the Admin would see them when in the main wiki:
17966-afterPR2
The second one shows mention notifications as the Admin would see them when in the sub wiki:
17966-afterPR1

We can see on both of these examples that the wiki name is displayed on mention notifications coming from another wiki than the one currently navigated. This message works whatever the plurality of mentions in the notification is.

Executed Tests

Manual tests, see screenshots above.
Successfully passed mvn clean install -f xwiki-platform-core/xwiki-platform-mentions/xwiki-platform-mentions-notifications -Pdocker,quality,integration-tests. Tried to check the docker tests in xwiki-platform-mentions-test-docker too, but the build got stuck at INFO o.x.t.d.internal.junit5.WARBuilder - Resolving distribution dependencies ..., from experience it's an issue with our nexus instance.

Expected merging strategy

  • Prefers squash: Yes
  • Backport on branches:
    • 15.10.X, IMO it's a pretty safe change to backport and it's.

… they took place in Notifications

* Added a wiki indicator to mention notifications similar to the one found in regular notifications in notification/macros.vm
@Sereza7 Sereza7 added the backport stable-15.10.x Used for automatic backport to 15.10.x branch. label Apr 4, 2024
Copy link
Contributor

@manuelleduc manuelleduc left a comment

Choose a reason for hiding this comment

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

The code looks ok, but I'd suggest improving org.xwiki.mentions.templates.MentionPageTest to cover your changes.

@Sereza7 Sereza7 marked this pull request as draft April 4, 2024 12:14
@Sereza7
Copy link
Contributor Author

Sereza7 commented Apr 4, 2024

With the current nexus issues, I don't know how I'd try out the changes to the docker tests. Leaving this as a draft until I commit a properly tested improvement to MentionPageTest.

@manuelleduc
Copy link
Contributor

With the current nexus issues, I don't know how I'd try out the changes to the docker tests. Leaving this as a draft until I commit a properly tested improvement to MentionPageTest.

MentionPageTest page test is not a docker test, running mvn clean install -pl :xwiki-platform-mentions-notifications will work fine. And so will be running the test from your IDE.

… they took place in Notifications

* Added a test for the new template feature
@Sereza7 Sereza7 marked this pull request as ready for review April 4, 2024 15:12
@Sereza7
Copy link
Contributor Author

Sereza7 commented Apr 4, 2024

Added a test for the new feature, successfully passed: mvn clean install -pl :xwiki-platform-mentions-notifications -Pquality,integration-tests,docker.

velocityContext.put("xcontext", this.context);
// Template rendering.
String actual = templateManager.render("mentions/mention.vm");
String expected = IOUtils.toString(getClass().getResourceAsStream("/templates/mentions/mention2.html"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Wdyt of giving a slightly more descriptive name to mention2.html (e.g., mentionOtherWiki.html)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hum actually I'm not even sure comparing to a full html file is the way to go (I know I introduced the first test which was ok-ish to validate the general structure, but I'm not sure this is really the best approach).
What I suggest is to parse the content with jsoup, run selections on the resulting document and assert the existence and/or content of the selections.
I also suggest adding the "wiki" script services to the loaded components, it seems to be missing.
Of course, feel free to ping me if you need help.

@Sereza7 Sereza7 marked this pull request as draft April 4, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport stable-15.10.x Used for automatic backport to 15.10.x branch.
Projects
None yet
2 participants