Fix deleted pinned posts potentially counting towards the pinned posts limit (#19005)

Fixes #18938
local
Claire 2 years ago committed by GitHub
parent 02ba9cfa35
commit cedcece0cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      app/controllers/api/v1/statuses_controller.rb
  2. 2
      app/services/remove_status_service.rb

@ -77,6 +77,7 @@ class Api::V1::StatusesController < Api::BaseController
authorize @status, :destroy?
@status.discard
StatusPin.find_by(status: @status)&.destroy
@status.account.statuses_count = @status.account.statuses_count - 1
json = render_to_body json: @status, serializer: REST::StatusSerializer, source_requested: true

@ -21,6 +21,8 @@ class RemoveStatusService < BaseService
with_lock("distribute:#{@status.id}") do
@status.discard
StatusPin.find_by(status: @status)&.destroy
remove_from_self if @account.local?
remove_from_followers
remove_from_lists

Loading…
Cancel
Save