discourse/plugins/chat/app/models/chat/draft.rb
Jarek Radosz 378bed012c
DEV: Improve separation of core and plugin CI (#33583)
1. Use separate caches for plugins and core
2. Don't load plugins in non-plugin jobs
3. Propagate LOAD_PLUGINS to all steps
4. Check annotations of plugin models
5. Update outdated annotations
2025-07-14 14:28:30 +02:00

30 lines
786 B
Ruby
Vendored

# frozen_string_literal: true
module Chat
class Draft < ActiveRecord::Base
belongs_to :user
belongs_to :chat_channel, class_name: "Chat::Channel"
self.table_name = "chat_drafts"
validate :data_length
def data_length
if self.data && self.data.length > SiteSetting.max_chat_draft_length
self.errors.add(:base, I18n.t("chat.errors.draft_too_long"))
end
end
end
end
# == Schema Information
#
# Table name: chat_drafts
#
# id :bigint not null, primary key
# user_id :integer not null
# chat_channel_id :bigint not null
# data :text not null
# created_at :datetime not null
# updated_at :datetime not null
# thread_id :bigint
#