mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 03:25:00 +08:00
DEV: update syntax tree to latest (#24623)
update format to latest syntax tree
This commit is contained in:
@ -48,17 +48,17 @@ module Chat
|
||||
before_validation :generate_auto_slug
|
||||
|
||||
scope :with_categories,
|
||||
-> {
|
||||
-> do
|
||||
joins(
|
||||
"LEFT JOIN categories ON categories.id = chat_channels.chatable_id AND chat_channels.chatable_type = 'Category'",
|
||||
)
|
||||
}
|
||||
end
|
||||
scope :public_channels,
|
||||
-> {
|
||||
-> do
|
||||
with_categories.where(chatable_type: public_channel_chatable_types).where(
|
||||
"categories.id IS NOT NULL",
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
delegate :empty?, to: :chat_messages, prefix: true
|
||||
|
||||
|
@ -30,11 +30,11 @@ module Chat
|
||||
dependent: :destroy,
|
||||
foreign_key: :chat_message_id
|
||||
has_many :bookmarks,
|
||||
-> {
|
||||
-> do
|
||||
unscope(where: :bookmarkable_type).where(
|
||||
bookmarkable_type: Chat::Message.polymorphic_name,
|
||||
)
|
||||
},
|
||||
end,
|
||||
as: :bookmarkable,
|
||||
dependent: :destroy
|
||||
has_many :upload_references,
|
||||
@ -53,21 +53,21 @@ module Chat
|
||||
foreign_key: :chat_message_id
|
||||
|
||||
scope :in_public_channel,
|
||||
-> {
|
||||
-> do
|
||||
joins(:chat_channel).where(
|
||||
chat_channel: {
|
||||
chatable_type: Chat::Channel.public_channel_chatable_types,
|
||||
},
|
||||
)
|
||||
}
|
||||
end
|
||||
scope :in_dm_channel,
|
||||
-> {
|
||||
-> do
|
||||
joins(:chat_channel).where(
|
||||
chat_channel: {
|
||||
chatable_type: Chat::Channel.direct_channel_chatable_types,
|
||||
},
|
||||
)
|
||||
}
|
||||
end
|
||||
scope :created_before, ->(date) { where("chat_messages.created_at < ?", date) }
|
||||
scope :uncooked, -> { where("cooked_version <> ? or cooked_version IS NULL", BAKED_VERSION) }
|
||||
|
||||
|
@ -17,11 +17,11 @@ module Chat
|
||||
class_name: "Chat::Message"
|
||||
|
||||
has_many :chat_messages,
|
||||
-> {
|
||||
-> do
|
||||
where("deleted_at IS NULL").order(
|
||||
"chat_messages.created_at ASC, chat_messages.id ASC",
|
||||
)
|
||||
},
|
||||
end,
|
||||
foreign_key: :thread_id,
|
||||
primary_key: :id,
|
||||
class_name: "Chat::Message"
|
||||
|
Reference in New Issue
Block a user