better handling of bangtag-only posts that produce no output
parent
b28fae301a
commit
7f19514527
|
@ -58,7 +58,11 @@ class Api::V1::StatusesController < Api::BaseController
|
|||
content_type: status_params[:content_type],
|
||||
idempotency: request.headers['Idempotency-Key'])
|
||||
|
||||
render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer
|
||||
if @status.nil?
|
||||
raise Mastodon::ValidationError, 'Bangtags processed. No output.'
|
||||
else
|
||||
render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -730,10 +730,14 @@ class Bangtags
|
|||
|
||||
account.user.save
|
||||
|
||||
status.text = @chunks.join
|
||||
status.save
|
||||
|
||||
postprocess_after_save
|
||||
text = @chunks.join
|
||||
if text.blank?
|
||||
RemoveStatusService.new.call(@status)
|
||||
else
|
||||
status.text = text
|
||||
status.save
|
||||
postprocess_after_save
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -52,7 +52,7 @@ class PostStatusService < BaseService
|
|||
if scheduled?
|
||||
schedule_status!
|
||||
else
|
||||
process_status!
|
||||
return unless process_status!
|
||||
postprocess_status!
|
||||
bump_potential_friendship!
|
||||
end
|
||||
|
@ -148,8 +148,11 @@ class PostStatusService < BaseService
|
|||
@status = @account.statuses.create!(status_attributes)
|
||||
end
|
||||
|
||||
return false if @status.destroyed?
|
||||
|
||||
process_hashtags_service.call(@status, @tags, @preloaded_tags)
|
||||
process_mentions_service.call(@status)
|
||||
return true
|
||||
end
|
||||
|
||||
def schedule_status!
|
||||
|
|
Loading…
Reference in New Issue