Class: Jobs::NotifyTagChange

Inherits:
Base
  • Object
show all
Defined in:
app/jobs/regular/notify_tag_change.rb

Instance Method Summary collapse

Methods inherited from Base

acquire_cluster_concurrency_lock!, clear_cluster_concurrency_lock!, cluster_concurrency, cluster_concurrency_redis_key, delayed_perform, #error_context, get_cluster_concurrency, #last_db_duration, #log, #perform, #perform_immediately

Instance Method Details

#execute(args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/jobs/regular/notify_tag_change.rb', line 5

def execute(args)
  return if SiteSetting.disable_tags_edit_notifications && !args[:force]

  post = Post.find_by(id: args[:post_id])

  if post&.topic&.visible?
    post_alerter = PostAlerter.new
    post_alerter.notify_post_users(
      post,
      User.where(id: args[:notified_user_ids]),
      group_ids: all_tags_in_hidden_groups?(args) ? tag_group_ids(args) : nil,
      include_topic_watchers: !post.topic.private_message?,
      include_category_watchers: false,
    )
    post_alerter.notify_first_post_watchers(post, post_alerter.tag_watchers(post.topic))
  end
end