feat: Add a view for mentions (#3505)
- Added a new table mentions for saving user mentions - Added a filter conversation_type in the API - Added a view to see the mentions
This commit is contained in:
24
app/jobs/conversations/user_mention_job.rb
Normal file
24
app/jobs/conversations/user_mention_job.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
class Conversations::UserMentionJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(mentioned_user_ids, conversation_id, account_id)
|
||||
mentioned_user_ids.each do |mentioned_user_id|
|
||||
mention = Mention.find_by(
|
||||
user_id: mentioned_user_id,
|
||||
conversation_id: conversation_id,
|
||||
account_id: account_id
|
||||
)
|
||||
|
||||
if mention.nil?
|
||||
Mention.create(
|
||||
user_id: mentioned_user_id,
|
||||
conversation_id: conversation_id,
|
||||
mentioned_at: Time.zone.now,
|
||||
account_id: account_id
|
||||
)
|
||||
else
|
||||
mention.update(mentioned_at: Time.zone.now)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user