mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Compare commits
17 commits
c0816e134b
...
e93e07a2bc
Author | SHA1 | Date | |
---|---|---|---|
|
e93e07a2bc | ||
|
a50c8e951f | ||
|
2c1e75727d | ||
|
575babaee5 | ||
|
6197fb5ca5 | ||
|
3b3e5cd5ac | ||
|
a9ee0af17b | ||
|
80f43f6bb8 | ||
|
8be2b64621 | ||
|
cd557564b1 | ||
|
7eee1d9bc4 | ||
|
f7574c42db | ||
|
151f1e6d9d | ||
|
a5af04e538 | ||
|
4e9bd7d811 | ||
|
60b47f8512 | ||
|
922373c8f5 |
19 changed files with 82 additions and 87 deletions
|
@ -60,7 +60,7 @@ export interface BaseNotificationGroupJSON {
|
|||
|
||||
interface NotificationGroupWithStatusJSON extends BaseNotificationGroupJSON {
|
||||
type: NotificationWithStatusType;
|
||||
status: ApiStatusJSON;
|
||||
status_id: string;
|
||||
}
|
||||
|
||||
interface NotificationWithStatusJSON extends BaseNotificationJSON {
|
||||
|
|
|
@ -49,22 +49,15 @@ export const FilteredNotificationsBanner: React.FC = () => {
|
|||
<span>
|
||||
<FormattedMessage
|
||||
id='filtered_notifications_banner.pending_requests'
|
||||
defaultMessage='Notifications from {count, plural, =0 {no one} one {one person} other {# people}} you may know'
|
||||
defaultMessage='From {count, plural, =0 {no one} one {one person} other {# people}} you may know'
|
||||
values={{ count: policy.summary.pending_requests_count }}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className='filtered-notifications-banner__badge'>
|
||||
<div className='filtered-notifications-banner__badge__badge'>
|
||||
{toCappedNumber(policy.summary.pending_notifications_count)}
|
||||
</div>
|
||||
<FormattedMessage
|
||||
id='filtered_notifications_banner.mentions'
|
||||
defaultMessage='{count, plural, one {mention} other {mentions}}'
|
||||
values={{ count: policy.summary.pending_notifications_count }}
|
||||
/>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -300,8 +300,7 @@
|
|||
"filter_modal.select_filter.subtitle": "Use an existing category or create a new one",
|
||||
"filter_modal.select_filter.title": "Filter this post",
|
||||
"filter_modal.title.status": "Filter a post",
|
||||
"filtered_notifications_banner.mentions": "{count, plural, one {mention} other {mentions}}",
|
||||
"filtered_notifications_banner.pending_requests": "Notifications from {count, plural, =0 {no one} one {one person} other {# people}} you may know",
|
||||
"filtered_notifications_banner.pending_requests": "From {count, plural, =0 {no one} one {one person} other {# people}} you may know",
|
||||
"filtered_notifications_banner.title": "Filtered notifications",
|
||||
"firehose.all": "All",
|
||||
"firehose.local": "This server",
|
||||
|
|
|
@ -124,9 +124,9 @@ export function createNotificationGroupFromJSON(
|
|||
case 'mention':
|
||||
case 'poll':
|
||||
case 'update': {
|
||||
const { status, ...groupWithoutStatus } = group;
|
||||
const { status_id: statusId, ...groupWithoutStatus } = group;
|
||||
return {
|
||||
statusId: status.id,
|
||||
statusId,
|
||||
sampleAccountIds,
|
||||
...groupWithoutStatus,
|
||||
};
|
||||
|
|
|
@ -10170,20 +10170,6 @@ noscript {
|
|||
}
|
||||
}
|
||||
|
||||
&__badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 999px;
|
||||
background: var(--background-border-color);
|
||||
color: $darker-text-color;
|
||||
padding: 4px;
|
||||
padding-inline-end: 8px;
|
||||
gap: 6px;
|
||||
font-weight: 500;
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
word-break: keep-all;
|
||||
|
||||
&__badge {
|
||||
background: $ui-button-background-color;
|
||||
color: $white;
|
||||
|
@ -10191,7 +10177,6 @@ noscript {
|
|||
padding: 2px 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.notification-request {
|
||||
display: flex;
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
%th= t('imports.failures')
|
||||
%tbody
|
||||
- @recent_imports.each do |import|
|
||||
%tr
|
||||
%tr{ id: dom_id(import) }
|
||||
%td= t("imports.types.#{import.type}")
|
||||
%td
|
||||
- if import.state_unconfirmed?
|
||||
|
|
|
@ -40,15 +40,16 @@ RSpec.describe Admin::AccountsController do
|
|||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(assigns(:accounts))
|
||||
.to have_attributes(
|
||||
count: eq(1),
|
||||
klass: be(Account)
|
||||
)
|
||||
expect(accounts_table_rows.size)
|
||||
.to eq(1)
|
||||
expect(AccountFilter)
|
||||
.to have_received(:new)
|
||||
.with(hash_including(params))
|
||||
end
|
||||
|
||||
def accounts_table_rows
|
||||
Nokogiri::Slop(response.body).css('table.accounts-table tr')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
|
|
|
@ -13,7 +13,6 @@ RSpec.describe Admin::DomainAllowsController do
|
|||
it 'assigns a new domain allow' do
|
||||
get :new
|
||||
|
||||
expect(assigns(:domain_allow)).to be_instance_of(DomainAllow)
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,7 +13,6 @@ RSpec.describe Admin::DomainBlocksController do
|
|||
it 'assigns a new domain block' do
|
||||
get :new
|
||||
|
||||
expect(assigns(:domain_block)).to be_instance_of(DomainBlock)
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
@ -171,7 +170,6 @@ RSpec.describe Admin::DomainBlocksController do
|
|||
it 'returns http success' do
|
||||
get :edit, params: { id: domain_block.id }
|
||||
|
||||
expect(assigns(:domain_block)).to be_instance_of(DomainBlock)
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,11 +42,8 @@ RSpec.describe Admin::ExportDomainBlocksController do
|
|||
post :import, params: { admin_import: { data: fixture_file_upload('domain_blocks.csv') } }
|
||||
end
|
||||
|
||||
it 'renders page with expected domain blocks' do
|
||||
expect(assigns(:domain_blocks).map { |block| [block.domain, block.severity.to_sym] }).to contain_exactly(['bad.domain', :silence], ['worse.domain', :suspend], ['reject.media', :noop])
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
it 'renders page with expected domain blocks and returns http success' do
|
||||
expect(mapped_batch_table_rows).to contain_exactly(['bad.domain', :silence], ['worse.domain', :suspend], ['reject.media', :noop])
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
@ -56,14 +53,19 @@ RSpec.describe Admin::ExportDomainBlocksController do
|
|||
post :import, params: { admin_import: { data: fixture_file_upload('domain_blocks_list.txt') } }
|
||||
end
|
||||
|
||||
it 'renders page with expected domain blocks' do
|
||||
expect(assigns(:domain_blocks).map { |block| [block.domain, block.severity.to_sym] }).to contain_exactly(['bad.domain', :suspend], ['worse.domain', :suspend], ['reject.media', :suspend])
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
it 'renders page with expected domain blocks and returns http success' do
|
||||
expect(mapped_batch_table_rows).to contain_exactly(['bad.domain', :suspend], ['worse.domain', :suspend], ['reject.media', :suspend])
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
def mapped_batch_table_rows
|
||||
batch_table_rows.map { |row| [row.at_css('[id$=_domain]')['value'], row.at_css('[id$=_severity]')['value'].to_sym] }
|
||||
end
|
||||
|
||||
def batch_table_rows
|
||||
Nokogiri::Slop(response.body).css('body div.batch-table__row')
|
||||
end
|
||||
end
|
||||
|
||||
it 'displays error on no file selected' do
|
||||
|
|
|
@ -28,12 +28,15 @@ RSpec.describe Admin::InstancesController do
|
|||
it 'renders instances' do
|
||||
get :index, params: { page: 2 }
|
||||
|
||||
instances = assigns(:instances).to_a
|
||||
expect(instances.size).to eq 1
|
||||
expect(instances[0].domain).to eq 'less.popular'
|
||||
expect(instance_directory_links.size).to eq(1)
|
||||
expect(instance_directory_links.first.text.strip).to match('less.popular')
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
def instance_directory_links
|
||||
Nokogiri::Slop(response.body).css('div.directory__tag a')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
|
|
|
@ -18,7 +18,8 @@ describe Admin::InvitesController do
|
|||
|
||||
it 'renders index page' do
|
||||
expect(subject).to render_template :index
|
||||
expect(assigns(:invites)).to include invite
|
||||
expect(response.body)
|
||||
.to include(invite.code)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,39 +13,39 @@ describe Admin::ReportsController do
|
|||
|
||||
describe 'GET #index' do
|
||||
it 'returns http success with no filters' do
|
||||
specified = Fabricate(:report, action_taken_at: nil)
|
||||
Fabricate(:report, action_taken_at: Time.now.utc)
|
||||
specified = Fabricate(:report, action_taken_at: nil, comment: 'First report')
|
||||
other = Fabricate(:report, action_taken_at: Time.now.utc, comment: 'Second report')
|
||||
|
||||
get :index
|
||||
|
||||
reports = assigns(:reports).to_a
|
||||
expect(reports.size).to eq 1
|
||||
expect(reports[0]).to eq specified
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.body)
|
||||
.to include(specified.comment)
|
||||
.and not_include(other.comment)
|
||||
end
|
||||
|
||||
it 'returns http success with resolved filter' do
|
||||
specified = Fabricate(:report, action_taken_at: Time.now.utc)
|
||||
Fabricate(:report, action_taken_at: nil)
|
||||
specified = Fabricate(:report, action_taken_at: Time.now.utc, comment: 'First report')
|
||||
other = Fabricate(:report, action_taken_at: nil, comment: 'Second report')
|
||||
|
||||
get :index, params: { resolved: '1' }
|
||||
|
||||
reports = assigns(:reports).to_a
|
||||
expect(reports.size).to eq 1
|
||||
expect(reports[0]).to eq specified
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.body)
|
||||
.to include(specified.comment)
|
||||
.and not_include(other.comment)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'renders report' do
|
||||
report = Fabricate(:report)
|
||||
report = Fabricate(:report, comment: 'A big problem')
|
||||
|
||||
get :show, params: { id: report }
|
||||
|
||||
expect(assigns(:report)).to eq report
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.body)
|
||||
.to include(report.comment)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -46,8 +46,9 @@ describe AuthorizeInteractionsController do
|
|||
|
||||
get :show, params: { acct: 'http://example.com' }
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
expect(assigns(:resource)).to eq account
|
||||
expect(response)
|
||||
.to have_http_status(302)
|
||||
.and redirect_to(web_url("@#{account.pretty_acct}"))
|
||||
end
|
||||
|
||||
it 'sets resource from acct uri' do
|
||||
|
@ -58,8 +59,9 @@ describe AuthorizeInteractionsController do
|
|||
|
||||
get :show, params: { acct: 'acct:found@hostname' }
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
expect(assigns(:resource)).to eq account
|
||||
expect(response)
|
||||
.to have_http_status(302)
|
||||
.and redirect_to(web_url("@#{account.pretty_acct}"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ describe AccountControllerConcern do
|
|||
include AccountControllerConcern
|
||||
|
||||
def success
|
||||
head 200
|
||||
render plain: @account.username # rubocop:disable RSpec/InstanceVariable
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -51,12 +51,13 @@ describe AccountControllerConcern do
|
|||
context 'when account is not suspended' do
|
||||
let(:account) { Fabricate(:account, username: 'username') }
|
||||
|
||||
it 'assigns @account, returns success, and sets link headers' do
|
||||
it 'Prepares the account, returns success, and sets link headers' do
|
||||
get 'success', params: { account_username: account.username }
|
||||
|
||||
expect(assigns(:account)).to eq account
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.headers['Link'].to_s).to eq(expected_link_headers)
|
||||
expect(response.body)
|
||||
.to include(account.username)
|
||||
end
|
||||
|
||||
def expected_link_headers
|
||||
|
|
|
@ -21,9 +21,10 @@ RSpec.describe Settings::ImportsController do
|
|||
|
||||
it 'assigns the expected imports', :aggregate_failures do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(assigns(:recent_imports)).to eq [import]
|
||||
expect(assigns(:recent_imports)).to_not include(other_import)
|
||||
expect(response.headers['Cache-Control']).to include('private, no-store')
|
||||
expect(response.body)
|
||||
.to include("bulk_import_#{import.id}")
|
||||
.and not_include("bulk_import_#{other_import.id}")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -261,7 +262,8 @@ RSpec.describe Settings::ImportsController do
|
|||
it 'does not creates an unconfirmed bulk_import', :aggregate_failures do
|
||||
expect { subject }.to_not(change { user.account.bulk_imports.count })
|
||||
|
||||
expect(assigns(:import).errors).to_not be_empty
|
||||
expect(response.body)
|
||||
.to include('field_with_errors')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -9,11 +9,16 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
|
|||
it 'renders the new view' do
|
||||
subject
|
||||
|
||||
expect(assigns(:confirmation)).to be_instance_of Form::TwoFactorConfirmation
|
||||
expect(assigns(:provision_url)).to eq 'otpauth://totp/cb6e6126.ngrok.io:local-part%40domain?secret=thisisasecretforthespecofnewview&issuer=cb6e6126.ngrok.io'
|
||||
expect(assigns(:qrcode)).to be_instance_of RQRCode::QRCode
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response).to render_template(:new)
|
||||
expect(response.body)
|
||||
.to include(qr_code_markup)
|
||||
end
|
||||
|
||||
def qr_code_markup
|
||||
RQRCode::QRCode.new(
|
||||
'otpauth://totp/cb6e6126.ngrok.io:local-part%40domain?secret=thisisasecretforthespecofnewview&issuer=cb6e6126.ngrok.io'
|
||||
).as_svg(padding: 0, module_size: 4)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -61,10 +66,10 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
|
|||
expect { post_create_with_options }
|
||||
.to change { user.reload.otp_secret }.to 'thisisasecretforthespecofnewview'
|
||||
|
||||
expect(assigns(:recovery_codes)).to eq otp_backup_codes
|
||||
expect(flash[:notice]).to eq 'Two-factor authentication successfully enabled'
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response).to render_template('settings/two_factor_authentication/recovery_codes/index')
|
||||
expect(response.body).to include(*otp_backup_codes)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -15,10 +15,11 @@ describe Settings::TwoFactorAuthentication::RecoveryCodesController do
|
|||
sign_in user, scope: :user
|
||||
post :create, session: { challenge_passed_at: Time.now.utc }
|
||||
|
||||
expect(assigns(:recovery_codes)).to eq otp_backup_codes
|
||||
expect(flash[:notice]).to eq 'Recovery codes successfully regenerated'
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response).to render_template(:index)
|
||||
expect(response.body)
|
||||
.to include(*otp_backup_codes)
|
||||
end
|
||||
|
||||
it 'redirects when not signed in' do
|
||||
|
|
|
@ -10,13 +10,16 @@ describe SharesController do
|
|||
before { sign_in user }
|
||||
|
||||
describe 'GET #show' do
|
||||
subject(:body_classes) { assigns(:body_classes) }
|
||||
|
||||
before { get :show, params: { title: 'test title', text: 'test text', url: 'url1 url2' } }
|
||||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status 200
|
||||
expect(body_classes).to eq 'modal-layout compose-standalone'
|
||||
expect(body_class_values)
|
||||
.to include('modal-layout', 'compose-standalone')
|
||||
end
|
||||
|
||||
def body_class_values
|
||||
Nokogiri::Slop(response.body).css('body').first.classes
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue