mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-23 08:11:11 +08:00
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
30 lines
786 B
Ruby
Vendored
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
|
|
#
|