mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Compare commits
4 commits
1690ea3aaf
...
811b06c9a7
Author | SHA1 | Date | |
---|---|---|---|
|
811b06c9a7 | ||
|
a50c8e951f | ||
|
2c1e75727d | ||
|
ea6ed899e1 |
12 changed files with 35 additions and 45 deletions
|
@ -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 {
|
||||||
|
|
|
@ -49,21 +49,14 @@ 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>
|
|
||||||
<FormattedMessage
|
|
||||||
id='filtered_notifications_banner.mentions'
|
|
||||||
defaultMessage='{count, plural, one {mention} other {mentions}}'
|
|
||||||
values={{ count: policy.summary.pending_notifications_count }}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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,
|
||||||
};
|
};
|
||||||
|
|
|
@ -10171,25 +10171,10 @@ noscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
&__badge {
|
&__badge {
|
||||||
display: flex;
|
background: $ui-button-background-color;
|
||||||
align-items: center;
|
color: $white;
|
||||||
border-radius: 999px;
|
border-radius: 100px;
|
||||||
background: var(--background-border-color);
|
padding: 2px 8px;
|
||||||
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;
|
|
||||||
border-radius: 100px;
|
|
||||||
padding: 2px 8px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class SoftwareUpdate < ApplicationRecord
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def check_enabled?
|
def check_enabled?
|
||||||
ENV['UPDATE_CHECK_URL'] != ''
|
Rails.configuration.x.mastodon.software_update_url.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def pending_to_a
|
def pending_to_a
|
||||||
|
|
|
@ -27,7 +27,7 @@ class SoftwareUpdateCheckService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def api_url
|
def api_url
|
||||||
ENV.fetch('UPDATE_CHECK_URL', 'https://api.joinmastodon.org/update-check')
|
Rails.configuration.x.mastodon.software_update_url
|
||||||
end
|
end
|
||||||
|
|
||||||
def version
|
def version
|
||||||
|
|
|
@ -112,6 +112,9 @@ module Mastodon
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Load defaults from config/mastodon.yml
|
||||||
|
config.x.mastodon = config_for(:mastodon)
|
||||||
|
|
||||||
config.to_prepare do
|
config.to_prepare do
|
||||||
Doorkeeper::AuthorizationsController.layout 'modal'
|
Doorkeeper::AuthorizationsController.layout 'modal'
|
||||||
Doorkeeper::AuthorizedApplicationsController.layout 'admin'
|
Doorkeeper::AuthorizedApplicationsController.layout 'admin'
|
||||||
|
|
3
config/mastodon.yml
Normal file
3
config/mastodon.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
shared:
|
||||||
|
software_update_url: <%= ENV.fetch('UPDATE_CHECK_URL', 'https://api.joinmastodon.org/update-check') %>
|
|
@ -6,7 +6,11 @@ SimpleNavigation::Configuration.run do |navigation|
|
||||||
navigation.items do |n|
|
navigation.items do |n|
|
||||||
n.item :web, safe_join([fa_icon('chevron-left fw'), t('settings.back')]), root_path
|
n.item :web, safe_join([fa_icon('chevron-left fw'), t('settings.back')]), root_path
|
||||||
|
|
||||||
n.item :software_updates, safe_join([fa_icon('exclamation-circle fw'), t('admin.critical_update_pending')]), admin_software_updates_path, if: -> { ENV['UPDATE_CHECK_URL'] != '' && current_user.can?(:view_devops) && SoftwareUpdate.urgent_pending? }, html: { class: 'warning' }
|
n.item :software_updates,
|
||||||
|
safe_join([fa_icon('exclamation-circle fw'), t('admin.critical_update_pending')]),
|
||||||
|
admin_software_updates_path,
|
||||||
|
if: -> { Rails.configuration.x.mastodon.software_update_url.present? && current_user.can?(:view_devops) && SoftwareUpdate.urgent_pending? },
|
||||||
|
html: { class: 'warning' }
|
||||||
|
|
||||||
n.item :profile, safe_join([fa_icon('user fw'), t('settings.profile')]), settings_profile_path, if: -> { current_user.functional? && !self_destruct }, highlights_on: %r{/settings/profile|/settings/featured_tags|/settings/verification|/settings/privacy}
|
n.item :profile, safe_join([fa_icon('user fw'), t('settings.profile')]), settings_profile_path, if: -> { current_user.functional? && !self_destruct }, highlights_on: %r{/settings/profile|/settings/featured_tags|/settings/verification|/settings/privacy}
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,10 @@ describe Admin::SystemCheck::SoftwareVersionCheck do
|
||||||
|
|
||||||
context 'when checks are disabled' do
|
context 'when checks are disabled' do
|
||||||
around do |example|
|
around do |example|
|
||||||
ClimateControl.modify UPDATE_CHECK_URL: '' do
|
original = Rails.configuration.x.mastodon.software_update_url
|
||||||
example.run
|
Rails.configuration.x.mastodon.software_update_url = ''
|
||||||
end
|
example.run
|
||||||
|
Rails.configuration.x.mastodon.software_update_url = original
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns true' do
|
it 'returns true' do
|
||||||
|
|
|
@ -124,9 +124,10 @@ RSpec.describe SoftwareUpdateCheckService do
|
||||||
|
|
||||||
context 'when update checking is disabled' do
|
context 'when update checking is disabled' do
|
||||||
around do |example|
|
around do |example|
|
||||||
ClimateControl.modify UPDATE_CHECK_URL: '' do
|
original = Rails.configuration.x.mastodon.software_update_url
|
||||||
example.run
|
Rails.configuration.x.mastodon.software_update_url = ''
|
||||||
end
|
example.run
|
||||||
|
Rails.configuration.x.mastodon.software_update_url = original
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -148,9 +149,10 @@ RSpec.describe SoftwareUpdateCheckService do
|
||||||
let(:update_check_url) { 'https://api.example.com/update_check' }
|
let(:update_check_url) { 'https://api.example.com/update_check' }
|
||||||
|
|
||||||
around do |example|
|
around do |example|
|
||||||
ClimateControl.modify UPDATE_CHECK_URL: 'https://api.example.com/update_check' do
|
original = Rails.configuration.x.mastodon.software_update_url
|
||||||
example.run
|
Rails.configuration.x.mastodon.software_update_url = 'https://api.example.com/update_check'
|
||||||
end
|
example.run
|
||||||
|
Rails.configuration.x.mastodon.software_update_url = original
|
||||||
end
|
end
|
||||||
|
|
||||||
it_behaves_like 'when the feature is enabled'
|
it_behaves_like 'when the feature is enabled'
|
||||||
|
|
Loading…
Reference in a new issue