link_header (~> 0.0, >= 0.0.8)
rdf-normalize (0.5.0)
rdf (~> 3.2)
+ redcarpet (3.5.1)
redis (4.5.1)
- redis-namespace (1.8.1)
+ redis-namespace (1.8.2)
redis (>= 3.0.4)
regexp_parser (2.2.0)
request_store (1.5.0)
fog-core (<= 2.1.0)
fog-openstack (~> 0.3)
fuubar (~> 2.5)
+ gitlab-omniauth-openid-connect (~> 0.5.0)
hamlit-rails (~> 0.2)
+ hcaptcha (~> 7.1)
hiredis (~> 0.6)
htmlentities (~> 4.3)
http (~> 5.0)
#
# Table name: statuses
#
- # id :bigint(8) not null, primary key
- # uri :string
- # text :text default(""), not null
- # created_at :datetime not null
- # updated_at :datetime not null
- # in_reply_to_id :bigint(8)
- # reblog_of_id :bigint(8)
- # url :string
- # sensitive :boolean default(FALSE), not null
- # visibility :integer default("public"), not null
- # spoiler_text :text default(""), not null
- # reply :boolean default(FALSE), not null
- # language :string
- # conversation_id :bigint(8)
- # local :boolean
- # account_id :bigint(8) not null
- # application_id :bigint(8)
- # in_reply_to_account_id :bigint(8)
- # local_only :boolean
- # full_status_text :text default(""), not null
- # poll_id :bigint(8)
- # content_type :string
- # deleted_at :datetime
- # edited_at :datetime
- # trendable :boolean
+ # id :bigint(8) not null, primary key
+ # uri :string
+ # text :text default(""), not null
+ # created_at :datetime not null
+ # updated_at :datetime not null
+ # in_reply_to_id :bigint(8)
+ # reblog_of_id :bigint(8)
+ # url :string
+ # sensitive :boolean default(FALSE), not null
+ # visibility :integer default("public"), not null
+ # spoiler_text :text default(""), not null
+ # reply :boolean default(FALSE), not null
+ # language :string
+ # conversation_id :bigint(8)
+ # local :boolean
+ # account_id :bigint(8) not null
+ # application_id :bigint(8)
+ # in_reply_to_account_id :bigint(8)
++# local_only :boolean
+ # poll_id :bigint(8)
++# content_type :string
+ # deleted_at :datetime
+ # edited_at :datetime
+ # trendable :boolean
+ # ordered_media_attachment_ids :bigint(8) is an Array
#
class Status < ApplicationRecord
edits.create!(
text: text,
spoiler_text: spoiler_text,
- media_attachments_changed: media_attachments_changed,
+ sensitive: sensitive,
+ ordered_media_attachment_ids: ordered_media_attachment_ids || media_attachments.pluck(:id),
+ media_descriptions: ordered_media_attachments.map(&:description),
+ poll_options: preloadable_poll&.options,
account_id: account_id || self.account_id,
- created_at: at_time || edited_at
+ content_type: content_type,
+ created_at: at_time || edited_at,
+ rate_limit: rate_limit
)
end
#
# 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
+ # 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
attribute :content_map, if: :language?
attribute :updated, if: :edited?
- has_many :media_attachments, key: :attachment
+ attribute :direct_message, if: :non_public?
+
+ has_many :virtual_attachments, key: :attachment
has_many :virtual_tags, key: :tag
has_one :replies, serializer: ActivityPub::CollectionSerializer, if: :local?
end
def sensitive
- object.account.sensitized? || object.sensitive
+ object.account.sensitized? || object.sensitive || (!instance_options[:allow_local_only] && Setting.outgoing_spoilers.present?)
end
+ def virtual_attachments
+ object.ordered_media_attachments
+ end
+
def virtual_tags
object.active_mentions.to_a.sort_by(&:id) + object.tags + object.emojis
end
sensitive: @sensitive,
spoiler_text: @options[:spoiler_text] || '',
visibility: @visibility,
- language: valid_locale_or_nil(@options[:language].presence || @account.user&.preferred_posting_language || I18n.default_locale),
+ language: valid_locale_cascade(@options[:language], @account.user&.preferred_posting_language, I18n.default_locale),
application: @options[:application],
+ content_type: @options[:content_type] || @account.user&.setting_default_content_type,
rate_limit: @options[:with_rate_limit],
}.compact
end
remove_reblogs
remove_from_hashtags
remove_from_public
- remove_from_media if @status.media_attachments.any?
+ remove_from_media if @status.with_media?
+ remove_from_direct if status.direct_visibility?
remove_media
end
@status.text = @options[:text].presence || @options.delete(:spoiler_text) || '' if @options.key?(:text)
@status.spoiler_text = @options[:spoiler_text] || '' if @options.key?(:spoiler_text)
@status.sensitive = @options[:sensitive] || @options[:spoiler_text].present? if @options.key?(:sensitive) || @options.key?(:spoiler_text)
- @status.language = valid_locale_or_nil(@options[:language] || @status.language || @status.account.user&.preferred_posting_language || I18n.default_locale)
+ @status.language = valid_locale_cascade(@options[:language], @status.language, @status.account.user&.preferred_posting_language, I18n.default_locale)
+ @status.content_type = @options[:content_type] || @status.content_type
@status.edited_at = Time.now.utc
@status.save!
t.bigint "account_id"
t.text "text", default: "", null: false
t.text "spoiler_text", default: "", null: false
- t.boolean "media_attachments_changed", default: false, null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
+ t.string "content_type"
+ t.bigint "ordered_media_attachment_ids", array: true
+ t.text "media_descriptions", array: true
+ t.string "poll_options", array: true
+ t.boolean "sensitive"
t.index ["account_id"], name: "index_status_edits_on_account_id"
t.index ["status_id"], name: "index_status_edits_on_status_id"
end
"es6-symbol": "^3.1.3",
"escape-html": "^1.0.3",
"exif-js": "^2.3.0",
- "express": "^4.17.1",
+ "express": "^4.17.3",
+ "favico.js": "^0.3.10",
"file-loader": "^6.2.0",
"font-awesome": "^4.7.0",
"glob": "^7.2.0",