From: Thibaut Girka Date: Thu, 29 Aug 2019 10:07:50 +0000 (+0200) Subject: Merge branch 'master' into glitch-soc/merge-upstream X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=48b8a1f414e3d8430bd797e3db298fc5355ace2d;p=mastodon.git Merge branch 'master' into glitch-soc/merge-upstream Conflicts: - app/models/status.rb - app/services/remove_status_service.rb - db/schema.rb All conflicts were due to the addition of a `deleted_at` attribute to Statuses and reworked database indexes. --- 48b8a1f414e3d8430bd797e3db298fc5355ace2d diff --cc app/models/status.rb index de790027d,9cfaddcec..757deea06 --- a/app/models/status.rb +++ b/app/models/status.rb @@@ -21,10 -21,8 +21,11 @@@ # 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 # class Status < ApplicationRecord diff --cc app/services/remove_status_service.rb index c19fa2126,685c1d4bf..b2f712089 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@@ -23,8 -28,8 +28,9 @@@ class RemoveStatusService < BaseServic remove_from_hashtags remove_from_public remove_from_media if status.media_attachments.any? + remove_from_direct if status.direct_visibility? remove_from_spam_check + remove_media @status.destroy! else @@@ -145,12 -149,12 +151,18 @@@ redis.publish('timeline:public:local:media', @payload) if @status.local? end + def remove_from_direct + @mentions.each do |mention| + FeedManager.instance.unpush_from_direct(mention.account, @status) if mention.account.local? + end + end + + def remove_media + return if @options[:redraft] + + @status.media_attachments.destroy_all + end + def remove_from_spam_check redis.zremrangebyscore("spam_check:#{@status.account_id}", @status.id, @status.id) end diff --cc db/schema.rb index 7e62fe1f5,482bca367..328506b50 --- a/db/schema.rb +++ b/db/schema.rb @@@ -654,10 -643,10 +654,12 @@@ ActiveRecord::Schema.define(version: 20 t.bigint "account_id", null: false t.bigint "application_id" t.bigint "in_reply_to_account_id" + t.boolean "local_only" t.bigint "poll_id" + t.string "content_type" - t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20180106", order: { id: :desc } + t.datetime "deleted_at" + t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20190820", order: { id: :desc }, where: "(deleted_at IS NULL)" + t.index ["id", "account_id"], name: "index_statuses_local_20190824", order: { id: :desc }, where: "((local OR (uri IS NULL)) AND (deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))" t.index ["in_reply_to_account_id"], name: "index_statuses_on_in_reply_to_account_id" t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id" t.index ["reblog_of_id", "account_id"], name: "index_statuses_on_reblog_of_id_and_account_id"