about summary refs log tree commit diff
path: root/app/models/status_edit.rb
blob: 3d8098fe7632e7ab16f75527baba52dab9960331 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true
# == Schema Information
#
# Table name: status_edits
#
#  id                        :bigint(8)        not null, primary key
#  status_id                 :bigint(8)        not null
#  account_id                :bigint(8)
#  text                      :text             default(""), not null
#  spoiler_text              :text             default(""), not null
#  media_attachments_changed :boolean          default(FALSE), not null
#  created_at                :datetime         not null
#  updated_at                :datetime         not null
#  content_type              :string
#

class StatusEdit < ApplicationRecord
  belongs_to :status
  belongs_to :account, optional: true

  default_scope { order(id: :asc) }

  delegate :local?, to: :status

  def emojis
    return @emojis if defined?(@emojis)
    @emojis = CustomEmoji.from_text([spoiler_text, text].join(' '), status.account.domain)
  end
end