gab-social/app/models/chat_message.rb
mgabdev f6a7422704 Progress on DMs responsiveness
Progress on DMs responsiveness
2020-12-03 22:27:09 -05:00

34 lines
896 B
Ruby

# frozen_string_literal: true
# == Schema Information
#
# Table name: chat_messages
#
# id :bigint(8) not null, primary key
# text :text default(""), not null
# language :text default(""), not null
# from_account_id :integer not null
# chat_conversation_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# expires_at :datetime
#
class ChatMessage < ApplicationRecord
include Paginable
belongs_to :from_account, class_name: 'Account'
belongs_to :chat_conversation
validates_with ChatMessageLengthValidator
default_scope { recent }
scope :recent, -> { reorder(created_at: :desc) }
def emojis
return @emojis if defined?(@emojis)
@emojis = CustomEmoji.from_text(text)
end
end