-
Notifications
You must be signed in to change notification settings - Fork 36
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
FEATURE: new "notification level when assigned" user preference #626
FEATURE: new "notification level when assigned" user preference #626
Conversation
This adds a new user preference allowed users to control how the notification level of the topic they're assigned to changes. Internal ref - t/141162
Note: the system spec will keep failing until discourse/discourse#30821 is merged. |
@@ -506,6 +508,7 @@ def add_small_action_post(action_code, assign_to, text) | |||
@assigned_by, | |||
text, | |||
bump: false, | |||
auto_track: false, |
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.
We need this to prevent the "small action" / "whisper" post that is automatically created when assigning a topic from changing the notification level because the user "replied".
constructor(owner, args) { | ||
super(...arguments); | ||
if (this.siteSettings.assign_enabled) { | ||
args.outletArgs.customAttrNames.push("notification_level_when_assigned"); |
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 plugin is enabled, we add this user option to the list of options that are saved in the /my/preferences/tracking
user preferences page.
@@ -860,6 +860,8 @@ export default { | |||
|
|||
api.addUserSearchOption("assignableGroups"); | |||
|
|||
api.addSaveableUserOptionField("notification_level_when_assigned"); |
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.
We need to "globally" allow this user option to be "saveable" when save a user preference's page.
# frozen_string_literal: true | ||
class AddNotificationLevelWhenAssignedUserOption < ActiveRecord::Migration[7.2] | ||
def change | ||
add_column :user_options, :notification_level_when_assigned, :integer, null: false, default: 3 # watch topic |
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.
Keep the default of "watching" a topic on assign.
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.
LGTM overall! Just a small suggestion with localized text.
Co-authored-by: Keegan George <[email protected]>
Adds the "user-preferences-tracking-topics" plugin outlet to allow the `discourse-assign` plugin to add a new "notification level when assigned" user preference. There's also a new `customAttrNames` tracked property that allows plugins to add new user option to be saved from this screen / plugin outlet. Also changed the text used for the "notification level when replying" to match the one that is used for the "notification level when assigned" in discourse/discourse-assign#626. ## BEFORE <img width="375" alt="image" src="https://github.com/user-attachments/assets/178ba47e-f783-46d2-adae-28afec49b259" /> ## AFTER <img width="363" alt="Screenshot 2025-01-16 at 16 11 26" src="https://github.com/user-attachments/assets/215e9f86-62f7-48ea-b665-72cbf28abd21" /> DEV: remove unused topic-tracking component
This adds a new user preference allowed users to control how the notification level of the topic they're assigned to changes.
Internal ref - t/141162
Dependent on discourse/discourse#30821 being merged.