DEV: update syntax tree to latest (#24623)

update format to latest syntax tree
This commit is contained in:
Sam
2023-11-29 16:38:07 +11:00
committed by GitHub
parent d40c0b698c
commit b09422428d
35 changed files with 123 additions and 124 deletions

View File

@ -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

View File

@ -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) }

View File

@ -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"