1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Compare commits

...

24 commits

Author SHA1 Message Date
Matt Jankowski
0e9fc17013
Merge 9aa8e29758 into a50c8e951f 2024-07-31 14:07:11 +00:00
Claire
a50c8e951f
Fix issue with grouped notifications UI due to recent API change (#31224) 2024-07-31 13:23:08 +00:00
Claire
2c1e75727d
Change filtered notification banner design to take up less space (#31222) 2024-07-31 12:36:08 +00:00
Matt Jankowski
9aa8e29758 Use params_slice in api/v1/statuses/reblogs controller 2024-07-18 13:28:36 -04:00
Matt Jankowski
f9f558da7f Use params.slice in api/v2_alpha/notifications controller 2024-07-18 13:28:36 -04:00
Matt Jankowski
50bcdf5371 Use params.slice in api/v1/admin/reports controller 2024-07-18 13:28:36 -04:00
Matt Jankowski
8a705c479e Use params_slice in api/v1/media controller 2024-07-18 13:28:36 -04:00
Matt Jankowski
e133d908f1 Use params_slice in api/v1/admin/reports controller 2024-07-18 13:28:36 -04:00
Matt Jankowski
ade3a65676 Use params.slice in api/v1/apps controller 2024-07-18 13:28:36 -04:00
Matt Jankowski
6b43a08902 Use params.slice in api/v1/reports controller 2024-07-18 13:28:36 -04:00
Matt Jankowski
6486f58ef4 Use params.slice in api/v1/filters controller 2024-07-18 13:28:36 -04:00
Matt Jankowski
8a5595eb8d Use params.slice in api/v2/filters controller 2024-07-18 13:28:36 -04:00
Matt Jankowski
519ec1c9da Use params.slice in api/v1/notifications controller 2024-07-18 13:28:35 -04:00
Matt Jankowski
058a3d8467 Use params.slice in api/v1/lists/accounts controller 2024-07-18 13:28:35 -04:00
Matt Jankowski
41708456a1 Use params_slice in api/v2/admin/accounts controller 2024-07-18 13:28:35 -04:00
Matt Jankowski
7066147622 Use params_slice in api/v1/admin/accounts controller 2024-07-18 13:28:35 -04:00
Matt Jankowski
169e524f46 Use params slice and uniq constant in admin::filter_helper 2024-07-18 13:28:35 -04:00
Matt Jankowski
e29478ae69 Use params_slice in api/v1/admin/ip_blocks controller 2024-07-18 13:28:35 -04:00
Matt Jankowski
d9f7780598 Use params_slice in api/v1/lists controller 2024-07-18 13:28:35 -04:00
Matt Jankowski
a8ccfd227b Use params_slice in api/v1/admin/domain_blocks controller 2024-07-18 13:28:35 -04:00
Matt Jankowski
3f4c231186 Use params_slice in api/v2/filters/statuses controller 2024-07-18 13:28:35 -04:00
Matt Jankowski
db9f834f47 Use params_slice in api/v2/filters/keywords controller 2024-07-18 13:28:35 -04:00
Matt Jankowski
7e04f35373 Use params_slice in api/v1/admin/accounts controller 2024-07-18 13:28:35 -04:00
Matt Jankowski
c66942aa0a Add missing params to api/v2/search controller 2024-07-18 13:28:35 -04:00
25 changed files with 53 additions and 58 deletions

View file

@ -26,7 +26,7 @@ class Api::V1::Admin::AccountActionsController < Api::BaseController
end end
def resource_params def resource_params
params.permit( params_slice(
:type, :type,
:report_id, :report_id,
:warning_preset_id, :warning_preset_id,

View file

@ -108,7 +108,7 @@ class Api::V1::Admin::AccountsController < Api::BaseController
end end
def filter_params def filter_params
params.permit(*FILTER_PARAMS) params_slice(*FILTER_PARAMS)
end end
def translated_filter_params def translated_filter_params

View file

@ -67,7 +67,7 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
end end
def domain_block_params def domain_block_params
params.permit(:severity, :reject_media, :reject_reports, :private_comment, :public_comment, :obfuscate) params_slice(:severity, :reject_media, :reject_reports, :private_comment, :public_comment, :obfuscate)
end end
def next_path def next_path

View file

@ -56,7 +56,7 @@ class Api::V1::Admin::IpBlocksController < Api::BaseController
end end
def resource_params def resource_params
params.permit(:ip, :severity, :comment, :expires_in) params_slice(:ip, :severity, :comment, :expires_in)
end end
def next_path def next_path

View file

@ -82,11 +82,13 @@ class Api::V1::Admin::ReportsController < Api::BaseController
end end
def report_params def report_params
params.permit(:category, rule_ids: []) params
.slice(:category, :rule_ids)
.permit(:category, rule_ids: [])
end end
def filter_params def filter_params
params.permit(*FILTER_PARAMS) params_slice(*FILTER_PARAMS)
end end
def next_path def next_path

View file

@ -20,10 +20,12 @@ class Api::V1::AppsController < Api::BaseController
end end
def app_scopes_or_default def app_scopes_or_default
app_params[:scopes] || Doorkeeper.configuration.default_scopes Array(app_params[:scopes]).first || Doorkeeper.configuration.default_scopes
end end
def app_params def app_params
params.permit(:client_name, :scopes, :website, :redirect_uris, redirect_uris: []) params
.slice(:client_name, :scopes, :website, :redirect_uris, :redirect_uris)
.permit(:client_name, :scopes, :website, :redirect_uris, redirect_uris: [], scopes: [])
end end
end end

View file

@ -52,7 +52,9 @@ class Api::V1::FiltersController < Api::BaseController
end end
def resource_params def resource_params
params.permit(:phrase, :expires_in, :irreversible, :whole_word, context: []) params
.slice(:phrase, :expires_in, :irreversible, :whole_word, :context)
.permit(:phrase, :expires_in, :irreversible, :whole_word, context: [])
end end
def filter_params def filter_params

View file

@ -52,7 +52,7 @@ class Api::V1::Lists::AccountsController < Api::BaseController
end end
def resource_params def resource_params
params.permit(account_ids: []) params.slice(:account_ids).permit(account_ids: [])
end end
def next_path def next_path

View file

@ -42,6 +42,6 @@ class Api::V1::ListsController < Api::BaseController
end end
def list_params def list_params
params.permit(:title, :replies_policy, :exclusive) params_slice(:title, :replies_policy, :exclusive)
end end
end end

View file

@ -40,11 +40,11 @@ class Api::V1::MediaController < Api::BaseController
end end
def media_attachment_params def media_attachment_params
params.permit(:file, :thumbnail, :description, :focus) params_slice(:file, :thumbnail, :description, :focus)
end end
def updateable_media_attachment_params def updateable_media_attachment_params
params.permit(:thumbnail, :description, :focus) params_slice(:thumbnail, :description, :focus)
end end
def file_type_error def file_type_error

View file

@ -85,7 +85,9 @@ class Api::V1::NotificationsController < Api::BaseController
end end
def browserable_params def browserable_params
params.permit(:account_id, :include_filtered, types: [], exclude_types: []) params
.slice(:account_id, :include_filtered, :types, :exclude_types)
.permit(:account_id, :include_filtered, types: [], exclude_types: [])
end end
def pagination_params(core_params) def pagination_params(core_params)

View file

@ -23,6 +23,8 @@ class Api::V1::ReportsController < Api::BaseController
end end
def report_params def report_params
params.permit(:account_id, :comment, :category, :forward, forward_to_domains: [], status_ids: [], rule_ids: []) params
.slice(:account_id, :comment, :category, :forward, :forward_to_domains, :status_ids, :rule_ids)
.permit(:account_id, :comment, :category, :forward, :rule_ids, forward_to_domains: [], status_ids: [], rule_ids: [])
end end
end end

View file

@ -50,6 +50,6 @@ class Api::V1::Statuses::ReblogsController < Api::V1::Statuses::BaseController
end end
def reblog_params def reblog_params
params.permit(:visibility) params_slice(:visibility)
end end
end end

View file

@ -12,6 +12,7 @@ class Api::V2::Admin::AccountsController < Api::V1::Admin::AccountsController
ip ip
invited_by invited_by
role_ids role_ids
role_ids: []
).freeze ).freeze
PAGINATION_PARAMS = (%i(limit) + FILTER_PARAMS).freeze PAGINATION_PARAMS = (%i(limit) + FILTER_PARAMS).freeze
@ -39,7 +40,7 @@ class Api::V2::Admin::AccountsController < Api::V1::Admin::AccountsController
end end
def filter_params def filter_params
params.permit(*FILTER_PARAMS, role_ids: []) params_slice(*FILTER_PARAMS)
end end
def pagination_params(core_params) def pagination_params(core_params)

View file

@ -45,6 +45,6 @@ class Api::V2::Filters::KeywordsController < Api::BaseController
end end
def resource_params def resource_params
params.permit(:keyword, :whole_word) params_slice(:keyword, :whole_word)
end end
end end

View file

@ -39,6 +39,6 @@ class Api::V2::Filters::StatusesController < Api::BaseController
end end
def resource_params def resource_params
params.permit(:status_id) params_slice(:status_id)
end end
end end

View file

@ -43,6 +43,8 @@ class Api::V2::FiltersController < Api::BaseController
end end
def resource_params def resource_params
params.permit(:title, :expires_in, :filter_action, context: [], keywords_attributes: [:id, :keyword, :whole_word, :_destroy]) params
.slice(:title, :expires_in, :filter_action, :context, :keywords_attributes)
.permit(:title, :expires_in, :filter_action, context: [], keywords_attributes: [:id, :keyword, :whole_word, :_destroy])
end end
end end

View file

@ -63,6 +63,6 @@ class Api::V2::SearchController < Api::BaseController
end end
def search_params def search_params
params.permit(:type, :offset, :min_id, :max_id, :account_id, :following) params.permit(:q, :resolve, :type, :offset, :min_id, :max_id, :account_id, :following)
end end
end end

View file

@ -125,10 +125,15 @@ class Api::V2Alpha::NotificationsController < Api::BaseController
end end
def browserable_params def browserable_params
params.permit(:include_filtered, types: [], exclude_types: []) params
.slice(:include_filtered, :types, :exclude_types)
.permit(:include_filtered, types: [], exclude_types: [])
end end
def pagination_params(core_params) def pagination_params(core_params)
params.slice(:limit, :types, :exclude_types, :include_filtered).permit(:limit, :include_filtered, types: [], exclude_types: []).merge(core_params) params
.slice(:limit, :types, :exclude_types, :include_filtered)
.permit(:limit, :include_filtered, types: [], exclude_types: [])
.merge(core_params)
end end
end end

View file

@ -15,7 +15,7 @@ module Admin::FilterHelper
AnnouncementFilter::KEYS, AnnouncementFilter::KEYS,
Admin::ActionLogFilter::KEYS, Admin::ActionLogFilter::KEYS,
Admin::StatusFilter::KEYS, Admin::StatusFilter::KEYS,
].flatten.freeze ].flatten.uniq.freeze
def filter_link_to(text, link_to_params, link_class_params = link_to_params) def filter_link_to(text, link_to_params, link_class_params = link_to_params)
new_url = filtered_url_for(link_to_params) new_url = filtered_url_for(link_to_params)
@ -48,6 +48,6 @@ module Admin::FilterHelper
end end
def controller_request_params def controller_request_params
params.permit(FILTERS) params.slice(FILTERS).permit(FILTERS)
end end
end end

View file

@ -60,7 +60,7 @@ export interface BaseNotificationGroupJSON {
interface NotificationGroupWithStatusJSON extends BaseNotificationGroupJSON { interface NotificationGroupWithStatusJSON extends BaseNotificationGroupJSON {
type: NotificationWithStatusType; type: NotificationWithStatusType;
status: ApiStatusJSON; status_id: string;
} }
interface NotificationWithStatusJSON extends BaseNotificationJSON { interface NotificationWithStatusJSON extends BaseNotificationJSON {

View file

@ -49,22 +49,15 @@ export const FilteredNotificationsBanner: React.FC = () => {
<span> <span>
<FormattedMessage <FormattedMessage
id='filtered_notifications_banner.pending_requests' 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 }} values={{ count: policy.summary.pending_requests_count }}
/> />
</span> </span>
</div> </div>
<div className='filtered-notifications-banner__badge'> <div className='filtered-notifications-banner__badge'>
<div className='filtered-notifications-banner__badge__badge'>
{toCappedNumber(policy.summary.pending_notifications_count)} {toCappedNumber(policy.summary.pending_notifications_count)}
</div> </div>
<FormattedMessage
id='filtered_notifications_banner.mentions'
defaultMessage='{count, plural, one {mention} other {mentions}}'
values={{ count: policy.summary.pending_notifications_count }}
/>
</div>
</Link> </Link>
); );
}; };

View file

@ -300,8 +300,7 @@
"filter_modal.select_filter.subtitle": "Use an existing category or create a new one", "filter_modal.select_filter.subtitle": "Use an existing category or create a new one",
"filter_modal.select_filter.title": "Filter this post", "filter_modal.select_filter.title": "Filter this post",
"filter_modal.title.status": "Filter a post", "filter_modal.title.status": "Filter a post",
"filtered_notifications_banner.mentions": "{count, plural, one {mention} other {mentions}}", "filtered_notifications_banner.pending_requests": "From {count, plural, =0 {no one} one {one person} other {# people}} you may know",
"filtered_notifications_banner.pending_requests": "Notifications from {count, plural, =0 {no one} one {one person} other {# people}} you may know",
"filtered_notifications_banner.title": "Filtered notifications", "filtered_notifications_banner.title": "Filtered notifications",
"firehose.all": "All", "firehose.all": "All",
"firehose.local": "This server", "firehose.local": "This server",

View file

@ -124,9 +124,9 @@ export function createNotificationGroupFromJSON(
case 'mention': case 'mention':
case 'poll': case 'poll':
case 'update': { case 'update': {
const { status, ...groupWithoutStatus } = group; const { status_id: statusId, ...groupWithoutStatus } = group;
return { return {
statusId: status.id, statusId,
sampleAccountIds, sampleAccountIds,
...groupWithoutStatus, ...groupWithoutStatus,
}; };

View file

@ -10170,27 +10170,12 @@ 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 { &__badge {
background: $ui-button-background-color; background: $ui-button-background-color;
color: $white; color: $white;
border-radius: 100px; border-radius: 100px;
padding: 2px 8px; padding: 2px 8px;
} }
}
} }
.notification-request { .notification-request {