Merge pull request #2446 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 9f218c9924
local
commit
1c53aec00e
45 changed files with 480 additions and 173 deletions
@ -1,9 +1,9 @@ |
|||||||
# frozen_string_literal: true |
# frozen_string_literal: true |
||||||
|
|
||||||
class Api::V1::Apps::CredentialsController < Api::BaseController |
class Api::V1::Apps::CredentialsController < Api::BaseController |
||||||
before_action -> { doorkeeper_authorize! :read } |
|
||||||
|
|
||||||
def show |
def show |
||||||
render json: doorkeeper_token.application, serializer: REST::ApplicationSerializer, fields: %i(name website vapid_key) |
return doorkeeper_render_error unless valid_doorkeeper_token? |
||||||
|
|
||||||
|
render json: doorkeeper_token.application, serializer: REST::ApplicationSerializer, fields: %i(name website vapid_key client_id scopes) |
||||||
end |
end |
||||||
end |
end |
||||||
|
@ -0,0 +1,19 @@ |
|||||||
|
# frozen_string_literal: true |
||||||
|
|
||||||
|
module Admin |
||||||
|
module DisputesHelper |
||||||
|
def strike_action_label(appeal) |
||||||
|
t(key_for_action(appeal), |
||||||
|
scope: 'admin.strikes.actions', |
||||||
|
name: content_tag(:span, appeal.strike.account.username, class: 'username'), |
||||||
|
target: content_tag(:span, appeal.account.username, class: 'target')) |
||||||
|
.html_safe |
||||||
|
end |
||||||
|
|
||||||
|
private |
||||||
|
|
||||||
|
def key_for_action(appeal) |
||||||
|
AccountWarning.actions.slice(appeal.strike.action).keys.first |
||||||
|
end |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,4 @@ |
|||||||
|
inherit_from: ../../.rubocop.yml |
||||||
|
|
||||||
|
Naming/VariableNumber: |
||||||
|
CheckSymbols: false |
@ -0,0 +1,21 @@ |
|||||||
|
# frozen_string_literal: true |
||||||
|
|
||||||
|
require 'rails_helper' |
||||||
|
|
||||||
|
describe Admin::DisputesHelper do |
||||||
|
describe 'strike_action_label' do |
||||||
|
it 'returns html describing the appeal' do |
||||||
|
adam = Account.new(username: 'Adam') |
||||||
|
becky = Account.new(username: 'Becky') |
||||||
|
strike = AccountWarning.new(account: adam, action: :suspend) |
||||||
|
appeal = Appeal.new(strike: strike, account: becky) |
||||||
|
|
||||||
|
expected = <<~OUTPUT.strip |
||||||
|
<span class="username">Adam</span> suspended <span class="target">Becky</span>'s account |
||||||
|
OUTPUT |
||||||
|
result = helper.strike_action_label(appeal) |
||||||
|
|
||||||
|
expect(result).to eq(expected) |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue