Add account sensitized (#14361)
* Add account sensitized * Fix i18n normalize * Fix description and spec * Fix spec * Fix wording
This commit is contained in:
		| @@ -127,6 +127,24 @@ RSpec.describe Api::V1::Admin::AccountsController, type: :controller do | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   describe 'POST #unsensitive' do | ||||
|     before do | ||||
|       account.touch(:sensitized_at) | ||||
|       post :unsensitive, params: { id: account.id } | ||||
|     end | ||||
|  | ||||
|     it_behaves_like 'forbidden for wrong scope', 'write:statuses' | ||||
|     it_behaves_like 'forbidden for wrong role', 'user' | ||||
|  | ||||
|     it 'returns http success' do | ||||
|       expect(response).to have_http_status(200) | ||||
|     end | ||||
|  | ||||
|     it 'unsensitives account' do | ||||
|       expect(account.reload.sensitized?).to be false | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   describe 'POST #unsilence' do | ||||
|     before do | ||||
|       account.touch(:silenced_at) | ||||
|   | ||||
| @@ -115,16 +115,16 @@ RSpec.describe Admin::AccountAction, type: :model do | ||||
|     context 'account.local?' do | ||||
|       let(:account) { Fabricate(:account, domain: nil) } | ||||
|  | ||||
|       it 'returns ["none", "disable", "silence", "suspend"]' do | ||||
|         expect(subject).to eq %w(none disable silence suspend) | ||||
|       it 'returns ["none", "disable", "sensitive", "silence", "suspend"]' do | ||||
|         expect(subject).to eq %w(none disable sensitive silence suspend) | ||||
|       end | ||||
|     end | ||||
|  | ||||
|     context '!account.local?' do | ||||
|       let(:account) { Fabricate(:account, domain: 'hoge.com') } | ||||
|  | ||||
|       it 'returns ["silence", "suspend"]' do | ||||
|         expect(subject).to eq %w(silence suspend) | ||||
|       it 'returns ["sensitive", "silence", "suspend"]' do | ||||
|         expect(subject).to eq %w(sensitive silence suspend) | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -8,7 +8,7 @@ RSpec.describe AccountPolicy do | ||||
|   let(:admin)   { Fabricate(:user, admin: true).account } | ||||
|   let(:john)    { Fabricate(:user).account } | ||||
|  | ||||
|   permissions :index?, :show?, :unsuspend?, :unsilence?, :remove_avatar?, :remove_header? do | ||||
|   permissions :index?, :show?, :unsuspend?, :unsensitive?, :unsilence?, :remove_avatar?, :remove_header? do | ||||
|     context 'staff' do | ||||
|       it 'permits' do | ||||
|         expect(subject).to permit(admin) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user