mirror of
https://ghfast.top/https://github.com/discourse/discourse-solved-reminders-plugin.git
synced 2026-07-15 11:36:26 +08:00
Some checks are pending
Discourse Plugin / ci (push) Waiting to run
* FEATURE: Allow shorter `remind_mark_solution_after_days` windows Previously, solved reminder PMs could not reliably be scheduled sooner than 14 days because the job only ran every 14 days and did not track per-topic reminder state. This change runs the reminder job daily, allows lower reminder thresholds, and stores reminder state per topic while seeding existing active sites to avoid duplicate reminder bursts. * implement suggestions per feedback
30 lines
1 KiB
Ruby
30 lines
1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
# name: discourse-solved-reminders-plugin
|
|
# about: A plugin to remind users to mark a solution
|
|
# meta_topic_id: TODO
|
|
# version: 0.0.1
|
|
# authors: Discourse
|
|
# url: TODO
|
|
# required_version: 2.7.0
|
|
|
|
enabled_site_setting :solved_reminders_plugin_enabled
|
|
|
|
module ::SolvedReminders
|
|
PLUGIN_NAME = "discourse-solved-reminders-plugin".freeze
|
|
USER_CUSTOM_FIELD_NAME = "dont_send_accepted_solution_notifications"
|
|
MARK_AS_SOLUTION_REMINDER_SENT_AT_FIELD = "solved_reminder_last_sent_at"
|
|
end
|
|
|
|
require_relative "lib/solved_reminders/engine"
|
|
|
|
after_initialize do
|
|
require_relative "app/jobs/regular/answer_similar_questions"
|
|
require_relative "app/jobs/scheduled/mark_as_solution"
|
|
|
|
on(:accepted_solution) { |post| Jobs.enqueue(:answer_similar_questions, post_id: post.id) }
|
|
|
|
User.register_custom_field_type(SolvedReminders::USER_CUSTOM_FIELD_NAME, :boolean)
|
|
register_editable_user_custom_field(SolvedReminders::USER_CUSTOM_FIELD_NAME)
|
|
DiscoursePluginRegistry.serialized_current_user_fields << SolvedReminders::USER_CUSTOM_FIELD_NAME
|
|
end
|