feat: Show last non-activity messages in the chat list (#5864)
This commit is contained in:
@@ -73,6 +73,7 @@ class Message < ApplicationRecord
|
||||
# .succ is a hack to avoid https://makandracards.com/makandra/1057-why-two-ruby-time-objects-are-not-equal-although-they-appear-to-be
|
||||
scope :unread_since, ->(datetime) { where('EXTRACT(EPOCH FROM created_at) > (?)', datetime.to_i.succ) }
|
||||
scope :chat, -> { where.not(message_type: :activity).where(private: false) }
|
||||
scope :non_activity_messages, -> { where.not(message_type: :activity).reorder('id desc') }
|
||||
scope :today, -> { where("date_trunc('day', created_at) = ?", Date.current) }
|
||||
default_scope { order(created_at: :asc) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user