Run rubocop -a
This commit is contained in:
parent
31d9da6172
commit
c781b34278
|
@ -10,7 +10,7 @@ class ActivityPub::Activity::EmojiReact < ActivityPub::Activity
|
|||
@account.reacted?(original_status, name)
|
||||
|
||||
custom_emoji = nil
|
||||
if name =~ /^:.*:$/
|
||||
if /^:.*:$/.match?(name)
|
||||
process_emoji_tags(@json['tag'])
|
||||
|
||||
name.delete! ':'
|
||||
|
|
|
@ -22,7 +22,7 @@ class ActivityPub::Activity::Like < ActivityPub::Activity
|
|||
return false if name.nil?
|
||||
|
||||
custom_emoji = nil
|
||||
if name =~ /^:.*:$/
|
||||
if /^:.*:$/.match?(name)
|
||||
process_emoji_tags(@json['tag'])
|
||||
|
||||
name.delete! ':'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: status_reactions
|
||||
|
|
|
@ -4,20 +4,20 @@ class UnreactService < BaseService
|
|||
include Payloadable
|
||||
|
||||
def call(account, status, emoji)
|
||||
name, domain = emoji.split('@')
|
||||
custom_emoji = CustomEmoji.find_by(shortcode: name, domain: domain)
|
||||
reaction = StatusReaction.find_by(account: account, status: status, name: name, custom_emoji: custom_emoji)
|
||||
return if reaction.nil?
|
||||
name, domain = emoji.split('@')
|
||||
custom_emoji = CustomEmoji.find_by(shortcode: name, domain: domain)
|
||||
reaction = StatusReaction.find_by(account: account, status: status, name: name, custom_emoji: custom_emoji)
|
||||
return if reaction.nil?
|
||||
|
||||
reaction.destroy!
|
||||
reaction.destroy!
|
||||
|
||||
json = Oj.dump(serialize_payload(reaction, ActivityPub::UndoEmojiReactionSerializer))
|
||||
if status.account.local?
|
||||
ActivityPub::RawDistributionWorker.perform_async(json, status.account.id)
|
||||
else
|
||||
ActivityPub::DeliveryWorker.perform_async(json, reaction.account_id, status.account.inbox_url)
|
||||
end
|
||||
|
||||
reaction
|
||||
json = Oj.dump(serialize_payload(reaction, ActivityPub::UndoEmojiReactionSerializer))
|
||||
if status.account.local?
|
||||
ActivityPub::RawDistributionWorker.perform_async(json, status.account.id)
|
||||
else
|
||||
ActivityPub::DeliveryWorker.perform_async(json, reaction.account_id, status.account.inbox_url)
|
||||
end
|
||||
|
||||
reaction
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,8 +18,8 @@ namespace :api, format: false do
|
|||
|
||||
# foreign custom emojis are encoded as shortcode@domain.tld
|
||||
# the constraint prevents rails from interpreting the ".tld" as a filename extension
|
||||
post '/react/:id', to: 'reactions#create', constraints: { id: /[^\/]+/ }
|
||||
post '/unreact/:id', to: 'reactions#destroy', constraints: { id: /[^\/]+/ }
|
||||
post '/react/:id', to: 'reactions#create', constraints: { id: %r{[^/]+} }
|
||||
post '/unreact/:id', to: 'reactions#destroy', constraints: { id: %r{[^/]+} }
|
||||
|
||||
resource :bookmark, only: :create
|
||||
post :unbookmark, to: 'bookmarks#destroy'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Fabricator(:status_reaction) do
|
||||
account nil
|
||||
status nil
|
||||
name "MyString"
|
||||
name 'MyString'
|
||||
custom_emoji nil
|
||||
end
|
||||
end
|
||||
|
|
Reference in New Issue