Class: Thredded::ActivityUpdaterJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
app/jobs/thredded/activity_updater_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(user_id, messageboard_id) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/jobs/thredded/activity_updater_job.rb', line 7

def perform(user_id, messageboard_id)
  now = Time.current

  user_detail = Thredded::UserDetail.find_or_initialize_by(user_id: user_id)
  user_detail.update!(last_seen_at: now)

  Thredded::MessageboardUser
    .find_or_initialize_by(
      thredded_messageboard_id: messageboard_id,
      thredded_user_detail_id: user_detail.id
    )
    .update!(last_seen_at: now)
end