Class: Jobs::ChangeDisplayName

Inherits:
Base
  • Object
show all
Defined in:
app/jobs/regular/change_display_name.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



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/jobs/regular/change_display_name.rb', line 11

def execute(args)
  @user = User.find_by(id: args[:user_id])

  return unless user.present?

  # We need to account for the case where the instance allows
  # name to be empty by falling back to username.
  @old_display_name = (args[:old_name].presence || user.username).unicode_normalize
  @new_display_name = (args[:new_name].presence || user.username).unicode_normalize

  @quote_rewriter = QuoteRewriter.new(user.id)

  update_posts
  update_revisions
end