diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-07-18 12:06:45 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-07-18 12:06:45 -0500 |
commit | 7f195145277d8e4e10ae086a99a30a83ec41b58d (patch) | |
tree | 8990c766df8a6cb872b366f8e3e29cb9b839a3ae /app/controllers/api/v1 | |
parent | b28fae301a338abe085780f6e74560190bd1c3e7 (diff) |
better handling of bangtag-only posts that produce no output
Diffstat (limited to 'app/controllers/api/v1')
-rw-r--r-- | app/controllers/api/v1/statuses_controller.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 52d0fb9bc..a9728f997 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -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 |