Skip to content

Commit

Permalink
Merge pull request #2865 from ClearlyClaire/glitch-soc/backports-4.3
Browse files Browse the repository at this point in the history
Merge upstream changes (stable-4.3)
  • Loading branch information
ClearlyClaire authored Oct 6, 2024
2 parents c8df7f4 + 354f549 commit 61e3e81
Show file tree
Hide file tree
Showing 141 changed files with 796 additions and 314 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/crowdin-download-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

# Create or update the pull request
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7.0.1
uses: peter-evans/create-pull-request@v7.0.5
with:
commit-message: 'New Crowdin translations'
title: 'New Crowdin Translations for ${{ github.base_ref || github.ref_name }} (automated)'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/crowdin-download.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:

# Create or update the pull request
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7.0.1
uses: peter-evans/create-pull-request@v7.0.5
with:
commit-message: 'New Crowdin translations'
title: 'New Crowdin Translations (automated)'
Expand Down
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ GEM
actionmailer (>= 3)
net-smtp
premailer (~> 1.7, >= 1.7.9)
propshaft (1.0.1)
propshaft (1.1.0)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
rack
Expand Down Expand Up @@ -698,7 +698,7 @@ GEM
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.3.7)
rexml (3.3.8)
rotp (6.3.0)
rouge (4.3.0)
rpam2 (4.0.2)
Expand Down Expand Up @@ -748,15 +748,15 @@ GEM
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-performance (1.21.1)
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.25.1)
rubocop-rails (2.26.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.4)
rubocop-rspec (3.0.5)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
Expand Down Expand Up @@ -884,7 +884,7 @@ GEM
webfinger (1.2.0)
activesupport
httpclient (>= 2.4)
webmock (3.23.1)
webmock (3.24.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/web_app_controller_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module WebAppControllerConcern
policy = ContentSecurityPolicy.new

if policy.sso_host.present?
p.form_action policy.sso_host
p.form_action policy.sso_host, -> { "https://#{request.host}/auth/auth/" }
else
p.form_action :none
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def show
end

def create
session[:new_otp_secret] = User.generate_otp_secret(32)
session[:new_otp_secret] = User.generate_otp_secret

redirect_to new_settings_two_factor_authentication_confirmation_path
end
Expand Down
18 changes: 17 additions & 1 deletion app/controllers/well_known/host_meta_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,23 @@ class HostMetaController < ActionController::Base # rubocop:disable Rails/Applic
def show
@webfinger_template = "#{webfinger_url}?resource={uri}"
expires_in 3.days, public: true
render content_type: 'application/xrd+xml', formats: [:xml]

respond_to do |format|
format.any do
render content_type: 'application/xrd+xml', formats: [:xml]
end

format.json do
render json: {
links: [
{
rel: 'lrdd',
template: @webfinger_template,
},
],
}
end
end
end
end
end
7 changes: 7 additions & 0 deletions app/helpers/admin/action_logs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@ def log_target(log)
end
end
end

def sorted_action_log_types
Admin::ActionLogFilter::ACTION_TYPE_MAP
.keys
.map { |key| [I18n.t("admin.action_logs.action_types.#{key}"), key] }
.sort_by(&:first)
end
end
7 changes: 7 additions & 0 deletions app/helpers/admin/dashboard_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ def relevant_account_ip(account, ip_query)
end
end

def date_range(range)
[l(range.first), l(range.last)]
.join(' - ')
end

def relevant_account_timestamp(account)
timestamp, exact = if account.user_current_sign_in_at && account.user_current_sign_in_at < 24.hours.ago
[account.user_current_sign_in_at, true]
elsif account.user_current_sign_in_at
[account.user_current_sign_in_at, false]
elsif account.user_pending?
[account.user_created_at, true]
elsif account.suspended_at.present? && account.local? && account.user.nil?
[account.suspended_at, true]
elsif account.last_status_at.present?
[account.last_status_at, true]
else
Expand Down
17 changes: 9 additions & 8 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# frozen_string_literal: true

module ApplicationHelper
DANGEROUS_SCOPES = %w(
read
write
follow
).freeze

RTL_LOCALES = %i(
ar
ckb
Expand Down Expand Up @@ -95,8 +89,11 @@ def title
Rails.env.production? ? site_title : "#{site_title} (Dev)"
end

def class_for_scope(scope)
'scope-danger' if DANGEROUS_SCOPES.include?(scope.to_s)
def label_for_scope(scope)
safe_join [
tag.samp(scope, class: { 'scope-danger' => SessionActivation::DEFAULT_SCOPES.include?(scope.to_s) }),
tag.span(t("doorkeeper.scopes.#{scope}"), class: :hint),
]
end

def can?(action, record)
Expand Down Expand Up @@ -244,6 +241,10 @@ def mascot_url
full_asset_url(instance_presenter.mascot&.file&.url || frontend_asset_path('images/elephant_ui_plane.svg'))
end

def copyable_input(options = {})
tag.input(type: :text, maxlength: 999, spellcheck: false, readonly: true, **options)
end

# glitch-soc addition to handle the multiple flavors
def preload_locale_pack
supported_locales = Themes.instance.flavour(current_flavour)['locales']
Expand Down
7 changes: 0 additions & 7 deletions app/helpers/webfinger_helper.rb

This file was deleted.

3 changes: 1 addition & 2 deletions app/javascript/flavours/glitch/actions/markers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export const synchronouslySubmitMarkers = createAppAsyncThunk(
});

return;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
} else if ('navigator' && 'sendBeacon' in navigator) {
} else if ('sendBeacon' in navigator) {
// Failing that, we can use sendBeacon, but we have to encode the data as
// FormData for DoorKeeper to recognize the token.
const formData = new FormData();
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/flavours/glitch/actions/notification_groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ function dispatchAssociatedRecords(

const supportedGroupedNotificationTypes = ['favourite', 'reblog'];

export function shouldGroupNotificationType(type: string) {
return supportedGroupedNotificationTypes.includes(type);
}

export const fetchNotifications = createDataLoadingThunk(
'notificationGroups/fetch',
async (_params, { getState }) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class Item extends PureComponent {

{visible && thumbnail}

{badges && (
{visible && badges && (
<div className='media-gallery__item__badges'>
{badges}
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/flavours/glitch/reducers/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ export default function compose(state = initialState, action) {
.set('isUploadingThumbnail', false)
.update('media_attachments', list => list.map(item => {
if (item.get('id') === action.media.id) {
return fromJS(action.media);
return fromJS(action.media).set('unattached', item.get('unattached'));
}

return item;
Expand Down
10 changes: 9 additions & 1 deletion app/javascript/flavours/glitch/reducers/notification_groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
unmountNotifications,
refreshStaleNotificationGroups,
pollRecentNotifications,
shouldGroupNotificationType,
} from 'flavours/glitch/actions/notification_groups';
import {
disconnectTimeline,
Expand Down Expand Up @@ -205,6 +206,13 @@ function processNewNotification(
groups: NotificationGroupsState['groups'],
notification: ApiNotificationJSON,
) {
if (!shouldGroupNotificationType(notification.type)) {
notification = {
...notification,
group_key: `ungrouped-${notification.id}`,
};
}

const existingGroupIndex = groups.findIndex(
(group) =>
group.type !== 'gap' && group.group_key === notification.group_key,
Expand Down Expand Up @@ -242,7 +250,7 @@ function processNewNotification(
groups.unshift(existingGroup);
}
} else {
// Create a new group
// We have not found an existing group, create a new one
groups.unshift(createNotificationGroupFromNotificationJSON(notification));
}
}
Expand Down
8 changes: 8 additions & 0 deletions app/javascript/flavours/glitch/styles/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ $content-width: 840px;
gap: 5px;
white-space: nowrap;

@media screen and (max-width: $mobile-breakpoint) {
flex: 1 0 50%;
}

&:hover,
&:focus,
&:active {
Expand Down Expand Up @@ -1075,6 +1079,10 @@ a.name-tag,
}
}

.icon {
vertical-align: middle;
}

a.announcements-list__item__title {
&:hover,
&:focus,
Expand Down
1 change: 1 addition & 0 deletions app/javascript/flavours/glitch/styles/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3793,6 +3793,7 @@ $ui-header-logo-wordmark-width: 99px;
overflow-y: auto;
width: 100%;
height: 100%;
z-index: 0;
}

.drawer__inner__mastodon {
Expand Down
1 change: 1 addition & 0 deletions app/javascript/flavours/glitch/styles/tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ a.table-action-link {
padding: 0 10px;
color: $darker-text-color;
font-weight: 500;
white-space: nowrap;

&:hover {
color: $highlight-text-color;
Expand Down
3 changes: 1 addition & 2 deletions app/javascript/mastodon/actions/markers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export const synchronouslySubmitMarkers = createAppAsyncThunk(
});

return;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
} else if ('navigator' && 'sendBeacon' in navigator) {
} else if ('sendBeacon' in navigator) {
// Failing that, we can use sendBeacon, but we have to encode the data as
// FormData for DoorKeeper to recognize the token.
const formData = new FormData();
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/mastodon/actions/notification_groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ function dispatchAssociatedRecords(

const supportedGroupedNotificationTypes = ['favourite', 'reblog'];

export function shouldGroupNotificationType(type: string) {
return supportedGroupedNotificationTypes.includes(type);
}

export const fetchNotifications = createDataLoadingThunk(
'notificationGroups/fetch',
async (_params, { getState }) =>
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/media_gallery.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class Item extends PureComponent {

{visible && thumbnail}

{badges && (
{visible && badges && (
<div className='media-gallery__item__badges'>
{badges}
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/reducers/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ export default function compose(state = initialState, action) {
.set('isUploadingThumbnail', false)
.update('media_attachments', list => list.map(item => {
if (item.get('id') === action.media.id) {
return fromJS(action.media);
return fromJS(action.media).set('unattached', item.get('unattached'));
}

return item;
Expand Down
10 changes: 9 additions & 1 deletion app/javascript/mastodon/reducers/notification_groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
unmountNotifications,
refreshStaleNotificationGroups,
pollRecentNotifications,
shouldGroupNotificationType,
} from 'mastodon/actions/notification_groups';
import {
disconnectTimeline,
Expand Down Expand Up @@ -205,6 +206,13 @@ function processNewNotification(
groups: NotificationGroupsState['groups'],
notification: ApiNotificationJSON,
) {
if (!shouldGroupNotificationType(notification.type)) {
notification = {
...notification,
group_key: `ungrouped-${notification.id}`,
};
}

const existingGroupIndex = groups.findIndex(
(group) =>
group.type !== 'gap' && group.group_key === notification.group_key,
Expand Down Expand Up @@ -242,7 +250,7 @@ function processNewNotification(
groups.unshift(existingGroup);
}
} else {
// Create a new group
// We have not found an existing group, create a new one
groups.unshift(createNotificationGroupFromNotificationJSON(notification));
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/javascript/material-icons/400-24px/breaking_news.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/javascript/material-icons/400-24px/captive_portal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/javascript/material-icons/400-24px/chat_bubble.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/javascript/material-icons/400-24px/cloud-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/javascript/material-icons/400-24px/cloud.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 61e3e81

Please sign in to comment.