mirror of
https://github.com/discourse/discourse.git
synced 2024-12-26 17:28:24 +08:00
09f2a42f5f
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).
22 lines
310 B
Ruby
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
|