discourse/plugins/chat/app/models/chat/null_message.rb
David Battersby 09f2a42f5f
FIX: build chat message excerpt for thread preview (#26765)
Follow up to #26712 to account for older threads that don't have a persisted excerpt, as this was previously generated on every page load.

This change allows us to build the excerpt on the fly when none exists, fixing the issue of missing message excerpts for thread previews (within channel) and thread lists (on mobile/desktop).
2024-04-26 14:29:35 +08:00

22 lines
310 B
Ruby

# frozen_string_literal: true
module Chat
class NullMessage < Chat::Message
def user
nil
end
def build_excerpt
nil
end
def id
nil
end
def created_at
Time.now # a proper NullTime object would be better, but this is good enough for now
end
end
end