# 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
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
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
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.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20180106", order: { id: :desc }
+ t.string "content_type"
+ 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"