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: Add pending assign reminder threshold setting #571

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/locales/server.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ en:
assign_mailer: "When to send notification email for assignments"
remind_assigns: "Remind users about pending assigns."
remind_assigns_frequency: "Frequency for reminding users about assigned topics."
pending_assign_reminder_threshold: "Number of pending assignments that triggers a reminder notification."
max_assigned_topics: "Maximum number of topics that can be assigned to a user."
assign_allowed_on_groups: "Users in these groups are allowed to assign topics and can be assigned topics."
enable_assign_status: "Add a customizable status field to every assignment."
Expand Down
4 changes: 4 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ discourse_assign:
client: true
enum: "RemindAssignsFrequencySiteSettings"
default: 0
pending_assign_reminder_threshold:
client: true
default: 2
min: 1
max_assigned_topics:
client: true
default: 10
Expand Down
2 changes: 1 addition & 1 deletion lib/pending_assigns_reminder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class PendingAssignsReminder
REMINDED_AT = "last_reminded_at"
REMINDERS_FREQUENCY = "remind_assigns_frequency"
CUSTOM_FIELD_NAME = "assigns_reminder"
REMINDER_THRESHOLD = 2
REMINDER_THRESHOLD = SiteSetting.pending_assign_reminder_threshold
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you can set the const here, as you cannot change the site setting after the server spin up. I think removing the const, and calling SiteSetting directly where the const is currently used should work.


def remind(user)
newest_topics = assigned_topics(user, order: :desc)
Expand Down