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

FEATURE: new "notification level when assigned" user preference #626

Merged
merged 4 commits into from
Jan 16, 2025

Conversation

ZogStriP
Copy link
Member

@ZogStriP ZogStriP commented Jan 16, 2025

This adds a new user preference allowed users to control how the notification level of the topic they're assigned to changes.

image

Internal ref - t/141162

Dependent on discourse/discourse#30821 being merged.

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
@ZogStriP
Copy link
Member Author

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,
Copy link
Member Author

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");
Copy link
Member Author

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");
Copy link
Member Author

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
Copy link
Member Author

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.

Copy link
Member

@keegangeorge keegangeorge left a 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.

config/locales/client.en.yml Outdated Show resolved Hide resolved
ZogStriP added a commit to discourse/discourse that referenced this pull request Jan 16, 2025
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
@ZogStriP ZogStriP merged commit 8c52b9a into main Jan 16, 2025
5 of 6 checks passed
@ZogStriP ZogStriP deleted the add-notification-level-when-assigned-user-preference branch January 16, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants