mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-27 11:41:35 +01:00
01d6f7529f
Conflicts: - `README.md`: Upstream added a link to the roadmap, but we have a completely different README. Kept ours. - `app/models/media_attachment.rb`: Upstream upped media attachment limits. Updated the default according to upstream's. - `db/migrate/20180831171112_create_bookmarks.rb`: Upstream changed the migration compatibility level. Did so too. - `config/initializers/content_security_policy.rb`: Upstream refactored this file but we have a different version. Kept our version. - `app/controllers/settings/preferences_controller.rb`: Upstream completely refactored user settings storage, and glitch-soc has a different set of settings. The file does not directly references individual settings anymore. Applied upstream changes. - `app/lib/user_settings_decorator.rb`: Upstream completely refactored user settings storage, and glitch-soc has a different set of settings. The file got removed entirely. Removed it as well. - `app/models/user.rb`: Upstream completely refactored user settings storage, and glitch-soc has a different set of settings. References to individual settings have been removed from the file. Removed them as well. - `app/views/settings/preferences/appearance/show.html.haml`: Upstream completely refactored user settings storage, and glitch-soc has a different set of settings. Applied upstream's changes and ported ours back. - `app/views/settings/preferences/notifications/show.html.haml`: Upstream completely refactored user settings storage, and glitch-soc has a different set of settings. Applied upstream's changes and ported ours back. - `app/views/settings/preferences/other/show.html.haml`: Upstream completely refactored user settings storage, and glitch-soc has a different set of settings. Applied upstream's changes and ported ours back. - `config/settings.yml`: Upstream completely refactored user settings storage, and glitch-soc has a different set of settings. In particular, upstream removed user-specific and unused settings. Did the same in glitch-soc. - `spec/controllers/application_controller_spec.rb`: Conflicts due to glitch-soc's theming system. Mostly kept our version, as upstream messed up the tests.
72 lines
2.4 KiB
Ruby
72 lines
2.4 KiB
Ruby
# 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
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
# content_type :string
|
|
# ordered_media_attachment_ids :bigint(8) is an Array
|
|
# media_descriptions :text is an Array
|
|
# poll_options :string is an Array
|
|
# sensitive :boolean
|
|
#
|
|
|
|
class StatusEdit < ApplicationRecord
|
|
include RateLimitable
|
|
|
|
self.ignored_columns += %w(
|
|
media_attachments_changed
|
|
)
|
|
|
|
class PreservedMediaAttachment < ActiveModelSerializers::Model
|
|
attributes :media_attachment, :description
|
|
|
|
delegate :id, :type, :url, :preview_url, :remote_url,
|
|
:preview_remote_url, :text_url, :meta, :blurhash,
|
|
:not_processed?, :needs_redownload?, :local?,
|
|
:file, :thumbnail, :thumbnail_remote_url,
|
|
:shortcode, :video?, :audio?, to: :media_attachment
|
|
end
|
|
|
|
rate_limit by: :account, family: :statuses
|
|
|
|
belongs_to :status
|
|
belongs_to :account, optional: true
|
|
|
|
default_scope { order(id: :asc) }
|
|
|
|
delegate :local?, :application, :edited?, :edited_at,
|
|
:discarded?, :visibility, to: :status
|
|
|
|
def emojis
|
|
return @emojis if defined?(@emojis)
|
|
|
|
@emojis = CustomEmoji.from_text([spoiler_text, text].join(' '), status.account.domain)
|
|
end
|
|
|
|
def ordered_media_attachments
|
|
return @ordered_media_attachments if defined?(@ordered_media_attachments)
|
|
|
|
@ordered_media_attachments = if ordered_media_attachment_ids.nil?
|
|
[]
|
|
else
|
|
map = status.media_attachments.index_by(&:id)
|
|
ordered_media_attachment_ids.map.with_index { |media_attachment_id, index| PreservedMediaAttachment.new(media_attachment: map[media_attachment_id], description: media_descriptions[index]) }
|
|
end
|
|
end
|
|
|
|
def proper
|
|
self
|
|
end
|
|
|
|
def reblog?
|
|
false
|
|
end
|
|
end
|