-
Notifications
You must be signed in to change notification settings - Fork 13k
[NEW] Allow user's default preferences configuration #7285
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
[NEW] Allow user's default preferences configuration #7285
Conversation
|
@RocketChat/core It would be nice if someone could review this PR. :-) |
|
I would love to see this merged! |
|
+1 Would also love to see this merged. |
|
@goiaba This will change the values to the default ones just when the user save his profile. Using that solution you will update the values and lost the state The correct implementation for this is create a helper function to return the user's setting instead of accessing the What do you think @goiaba ? |
|
@rodrigok You mean we should replace every The getUserPreference method would be responsible by choosing between the default value (when the user value is undefined) and the value the user set. If so, I like this approach. |
|
@goiaba Exactly that :) thanks |
3d21e95 to
810d8a8
Compare
810d8a8 to
ce3ff2e
Compare
tests/end-to-end/ui/11-admin.js
Outdated
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'm wondering why this if is necessary here. Why are all the groups already expanded (and consequently the expand class does not exists in the html) when the test reach the Accounts section?
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 have no idea 😄
|
@rodrigok I did some stuff here but need help to test accordingly. Too many changes... |
f201ba9 to
6952ba5
Compare
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 part is not good, we was getting only users that did change their configurations, not all users as this code does now.
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.
@rodrigok Actually, as I didn't touch the userIds list and we are using a findByIds function, I think we are getting the same users, but now returning all their preferences. Or the fields argument generates something like a where clause?
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.
🤦♂️ You're right, was too much code to read 😄
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.
Did you change Desktop_Notifications_Duration to Accounts_Default_User_Preferences_desktopNotificationDuration right? Is there a migration for that?
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.
Same for Desktop_Notifications_Default_Alert and Mobile_Notifications_Default_Alert
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.
Right, I forgot the migration script. :-( I Will work on it.
|
@goiaba It looks awesome, reviewing the code I had 2 main concerns:
|
070173a to
d78aec8
Compare
- The function returns one of three values: 1 - The user's preference (user.settings.preferences.<preference>) 2 - The default system setting value (Default_User_Preferences_<preference>) 3 - A default value passed as argument to the function - Besides the introduction of the helper function: - Removes unused preferences (user.settings.preferences.unreadRoomsMode, user.settings.preferences.audioNotificationValue) and creates migration script (v105) - Implements some simple tests
d78aec8 to
c7dcc51
Compare
@RocketChat/core
Closes #3887
This improvement allows to set default values to be used in user's preferences. It creates a new section named "Default User Settings" into "Accounts" section where default configurations can be set.