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-22010: The rights buttons for Unregistered Users do not display anymore the value set after page refresh #3006

Merged
merged 3 commits into from
Mar 21, 2024

Conversation

Sereza7
Copy link
Contributor

@Sereza7 Sereza7 commented Mar 21, 2024

Jira URL

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

Changes

Description

  • Renamed the r variable to a more explicit name : guestRights
  • Replaced the string value when calling MSCheckbox for guest users with an int value, like it is done for any other user
  • Indented blocks with a wrong indentation

Clarifications

This regression is caused because the MSCheckbox instantiation is done with a state of "1" (string) instead of 1 (int) for unregistered users.
This is inconsistent with the regular user/group MSCheckbox instantiation that used a numeric value. Beforehand it passed successfully because we used it as a list index. Now the check on the value doesn't pass and it's initialized with the default state : none.


I could think of 2 solutions:

  1. Fix the state selector to accept int and string as a state.

  2. Fix the MSCheckbox call to provide only ints for the state.

  3. could be considered as leaving a breaking change in. However the MSCheckbox class is documented nowhere. Because of that I suppose it's not part of our public API, so as long as we fix all internal uses, it's okay to update it.

I'd rather keep variable's type consistent here, so I'll go with 2.

Screenshots & Video

22010-demo.mp4

We can see on this video that unlike before, the state of the unregistered user checkboxes are correctly initialized after a refresh.

Executed Tests

Only manual tests, see demo above. No automatic tests were broken by this regression so I suppose fixing it does not break anything. Most of the changes in this PR are codestyle only.

Expected merging strategy

… anymore the value set after page refresh

* Renamed the r variable to a more explicit name : guestRights
* Replaced the string value when calling MSCheckbox for guest users with an int value, like it is done for any other user
* Indented blocks with a wrong indentation
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.

lgtm. @Sereza7 do you mind splitting this is two commits?

  • one for the actual fix
  • one [Misc] for the code style changes
    Thanks!

Sereza7 added 2 commits March 21, 2024 12:05
… display anymore the value set after page refresh"

This reverts commit 9c48aeb.
… anymore the value set after page refresh

* Replaced the string value when calling MSCheckbox for guest users with an int value, like it is done for any other user
@Sereza7
Copy link
Contributor Author

Sereza7 commented Mar 21, 2024

I reverted the previous commit and added back only the necessary change here 👍
I quickly ran a manual test and things still seem to be working well with this latest version

Started a PR with the misc changes at #3009 :)

@manuelleduc
Copy link
Contributor

Started a PR with the misc changes at #3009 :)

It's also acceptable to rework the history locally and "force-with-lease", I would I use "rebase and merge", but that works too. Thanks a lot!

@manuelleduc manuelleduc merged commit 9ccb17e into xwiki:master Mar 21, 2024
1 check passed
manuelleduc pushed a commit that referenced this pull request Mar 21, 2024
… anymore the value set after page refresh (#3006)

* Replace the string value when calling MSCheckbox for guest users with an int value, like it is done for any other user

(cherry picked from commit 9ccb17e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants