about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-01-25 01:48:46 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-01-25 01:48:46 +0100
commit10ffd455a8f5b423624a3d5696043efa07eccf03 (patch)
tree1e882ef2a000c87e113d514f792c612667fdbeea
parentca28d9c2aec0764dc9190e2802e5e6e23cf6d8c3 (diff)
Fix #522 - prevent blocked users from reblogging
-rw-r--r--app/services/reblog_service.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb
index 0cb51eecd..4ea0dbf6c 100644
--- a/app/services/reblog_service.rb
+++ b/app/services/reblog_service.rb
@@ -6,7 +6,9 @@ class ReblogService < BaseService
   # @param [Status] reblogged_status Status to be reblogged
   # @return [Status]
   def call(account, reblogged_status)
-    raise Mastodon::NotPermitted if reblogged_status.private_visibility?
+    reblogged_status = reblogged_status.reblog if reblogged_status.reblog?
+
+    raise Mastodon::NotPermitted if reblogged_status.private_visibility? || !reblogged_status.permitted?(account)
 
     reblog = account.statuses.create!(reblog: reblogged_status, text: '')