Skip to content

Commit

Permalink
Merge pull request #2829 from ClearlyClaire/glitch-soc/merge-upstream
Browse files Browse the repository at this point in the history
Merge upstream changes up to 02633d6
  • Loading branch information
ClearlyClaire authored Aug 31, 2024
2 parents 5f8f8cc + ee2c38f commit a859b0c
Show file tree
Hide file tree
Showing 75 changed files with 938 additions and 397 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ gem 'json-ld'
gem 'json-ld-preloaded', '~> 3.2'
gem 'rdf-normalize', '~> 0.5'

gem 'opentelemetry-api', '~> 1.3.0'
gem 'opentelemetry-api', '~> 1.4.0'

group :opentelemetry do
gem 'opentelemetry-exporter-otlp', '~> 0.28.0', require: false
gem 'opentelemetry-exporter-otlp', '~> 0.29.0', require: false
gem 'opentelemetry-instrumentation-active_job', '~> 0.7.1', require: false
gem 'opentelemetry-instrumentation-active_model_serializers', '~> 0.20.1', require: false
gem 'opentelemetry-instrumentation-concurrent_ruby', '~> 0.21.2', require: false
Expand Down
27 changes: 14 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,11 @@ GEM
ffi-compiler (1.3.2)
ffi (>= 1.15.5)
rake
flatware (2.3.2)
flatware (2.3.3)
drb
thor (< 2.0)
flatware-rspec (2.3.2)
flatware (= 2.3.2)
flatware-rspec (2.3.3)
flatware (= 2.3.3)
rspec (>= 3.6)
fog-core (2.5.0)
builder
Expand All @@ -290,8 +291,8 @@ GEM
globalid (1.2.1)
activesupport (>= 6.1)
google-protobuf (3.25.4)
googleapis-common-protos-types (1.14.0)
google-protobuf (~> 3.18)
googleapis-common-protos-types (1.15.0)
google-protobuf (>= 3.18, < 5.a)
haml (6.3.0)
temple (>= 0.8.2)
thor
Expand Down Expand Up @@ -489,10 +490,10 @@ GEM
openssl (3.2.0)
openssl-signature_algorithm (1.3.0)
openssl (> 2.0)
opentelemetry-api (1.3.0)
opentelemetry-common (0.20.1)
opentelemetry-api (1.4.0)
opentelemetry-common (0.21.0)
opentelemetry-api (~> 1.0)
opentelemetry-exporter-otlp (0.28.1)
opentelemetry-exporter-otlp (0.29.0)
google-protobuf (>= 3.18)
googleapis-common-protos-types (~> 1.3)
opentelemetry-api (~> 1.1)
Expand Down Expand Up @@ -710,7 +711,7 @@ GEM
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.1)
rspec-expectations (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-github (2.4.0)
Expand Down Expand Up @@ -780,7 +781,7 @@ GEM
scenic (1.8.0)
activerecord (>= 4.0.0)
railties (>= 4.0.0)
selenium-webdriver (4.23.0)
selenium-webdriver (4.24.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
Expand Down Expand Up @@ -833,7 +834,7 @@ GEM
terrapin (1.0.1)
climate_control
test-prof (1.4.1)
thor (1.3.1)
thor (1.3.2)
tilt (2.3.0)
timeout (0.4.1)
tpm-key_attestation (0.12.0)
Expand Down Expand Up @@ -980,8 +981,8 @@ DEPENDENCIES
omniauth-rails_csrf_protection (~> 1.0)
omniauth-saml (~> 2.0)
omniauth_openid_connect (~> 0.6.1)
opentelemetry-api (~> 1.3.0)
opentelemetry-exporter-otlp (~> 0.28.0)
opentelemetry-api (~> 1.4.0)
opentelemetry-exporter-otlp (~> 0.29.0)
opentelemetry-instrumentation-active_job (~> 0.7.1)
opentelemetry-instrumentation-active_model_serializers (~> 0.20.1)
opentelemetry-instrumentation-concurrent_ruby (~> 0.21.2)
Expand Down
10 changes: 5 additions & 5 deletions app/controllers/api/v2_alpha/notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def unread_count
limit = limit_param(DEFAULT_NOTIFICATIONS_COUNT_LIMIT, MAX_NOTIFICATIONS_COUNT_LIMIT)

with_read_replica do
render json: { count: browserable_account_notifications.paginate_groups_by_min_id(limit, min_id: notification_marker&.last_read_id).count }
render json: { count: browserable_account_notifications.paginate_groups_by_min_id(limit, min_id: notification_marker&.last_read_id, grouped_types: params[:grouped_types]).count }
end
end

Expand All @@ -68,7 +68,7 @@ def load_notifications
MastodonOTELTracer.in_span('Api::V2Alpha::NotificationsController#load_notifications') do
notifications = browserable_account_notifications.includes(from_account: [:account_stat, :user]).to_a_grouped_paginated_by_id(
limit_param(DEFAULT_NOTIFICATIONS_LIMIT),
params_slice(:max_id, :since_id, :min_id)
params.slice(:max_id, :since_id, :min_id, :grouped_types).permit(:max_id, :since_id, :min_id, grouped_types: [])
)

Notification.preload_cache_collection_target_statuses(notifications) do |target_statuses|
Expand All @@ -92,7 +92,7 @@ def load_group_metadata

def load_grouped_notifications
MastodonOTELTracer.in_span('Api::V2Alpha::NotificationsController#load_grouped_notifications') do
@notifications.map { |notification| NotificationGroup.from_notification(notification, max_id: @group_metadata.dig(notification.group_key, :max_id)) }
@notifications.map { |notification| NotificationGroup.from_notification(notification, max_id: @group_metadata.dig(notification.group_key, :max_id), grouped_types: params[:grouped_types]) }
end
end

Expand Down Expand Up @@ -125,11 +125,11 @@ def pagination_collection
end

def browserable_params
params.permit(:include_filtered, types: [], exclude_types: [])
params.slice(:include_filtered, :types, :exclude_types, :grouped_types).permit(:include_filtered, types: [], exclude_types: [], grouped_types: [])
end

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, :include_filtered, :types, :exclude_types, :grouped_types).permit(:limit, :include_filtered, types: [], exclude_types: [], grouped_types: []).merge(core_params)
end

def expand_accounts_param
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/flavours/glitch/components/status_prepend.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ export default class StatusPrepend extends PureComponent {
return (
<FormattedMessage
id='notification.favourite'
defaultMessage='{name} favorited your status'
defaultMessage='{name} favorited your post'
values={{ name : link }}
/>
);
case 'reblog':
return (
<FormattedMessage
id='notification.reblog'
defaultMessage='{name} boosted your status'
defaultMessage='{name} boosted your post'
values={{ name : link }}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const labelRenderer: LabelRenderer = (displayedName, total, seeMoreHref) => {
return (
<FormattedMessage
id='notification.favourite'
defaultMessage='{name} favorited your status'
defaultMessage='{name} favorited your post'
values={{ name: displayedName }}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { navigateToStatus } from 'flavours/glitch/actions/statuses';
import type { IconProp } from 'flavours/glitch/components/icon';
import { Icon } from 'flavours/glitch/components/icon';
import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp';
import { useAppDispatch } from 'flavours/glitch/store';
import { useAppSelector, useAppDispatch } from 'flavours/glitch/store';

import { AvatarGroup } from './avatar_group';
import { DisplayedName } from './displayed_name';
Expand Down Expand Up @@ -60,6 +60,10 @@ export const NotificationGroupWithStatus: React.FC<{
[labelRenderer, accountIds, count, labelSeeMoreHref],
);

const isPrivateMention = useAppSelector(
(state) => state.statuses.getIn([statusId, 'visibility']) === 'direct',
);

const handlers = useMemo(
() => ({
open: () => {
Expand All @@ -79,7 +83,10 @@ export const NotificationGroupWithStatus: React.FC<{
role='button'
className={classNames(
`notification-group focusable notification-group--${type}`,
{ 'notification-group--unread': unread },
{
'notification-group--unread': unread,
'notification-group--direct': isPrivateMention,
},
)}
tabIndex={0}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const labelRenderer: LabelRenderer = (displayedName, total, seeMoreHref) => {
return (
<FormattedMessage
id='notification.reblog'
defaultMessage='{name} boosted your status'
defaultMessage='{name} boosted your post'
values={{ name: displayedName }}
/>
);
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/flavours/glitch/styles/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,8 @@ body > [data-popper-placement] {
}

.status__wrapper-direct,
.notification-ungrouped--direct {
.notification-ungrouped--direct,
.notification-group--direct {
background: rgba($ui-highlight-color, 0.05);

&:focus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ import { RelationshipsSeveranceEvent } from './relationships_severance_event';
import Report from './report';

const messages = defineMessages({
favourite: { id: 'notification.favourite', defaultMessage: '{name} favorited your status' },
favourite: { id: 'notification.favourite', defaultMessage: '{name} favorited your post' },
follow: { id: 'notification.follow', defaultMessage: '{name} followed you' },
ownPoll: { id: 'notification.own_poll', defaultMessage: 'Your poll has ended' },
poll: { id: 'notification.poll', defaultMessage: 'A poll you voted in has ended' },
reblog: { id: 'notification.reblog', defaultMessage: '{name} boosted your status' },
reblog: { id: 'notification.reblog', defaultMessage: '{name} boosted your post' },
status: { id: 'notification.status', defaultMessage: '{name} just posted' },
update: { id: 'notification.update', defaultMessage: '{name} edited a post' },
adminSignUp: { id: 'notification.admin.sign_up', defaultMessage: '{name} signed up' },
Expand Down Expand Up @@ -201,7 +201,7 @@ class Notification extends ImmutablePureComponent {
<Icon id='star' icon={StarIcon} className='star-icon' />

<span title={notification.get('created_at')}>
<FormattedMessage id='notification.favourite' defaultMessage='{name} favorited your status' values={{ name: link }} />
<FormattedMessage id='notification.favourite' defaultMessage='{name} favorited your post' values={{ name: link }} />
</span>
</div>

Expand Down Expand Up @@ -231,7 +231,7 @@ class Notification extends ImmutablePureComponent {
<Icon id='retweet' icon={RepeatIcon} />

<span title={notification.get('created_at')}>
<FormattedMessage id='notification.reblog' defaultMessage='{name} boosted your status' values={{ name: link }} />
<FormattedMessage id='notification.reblog' defaultMessage='{name} boosted your post' values={{ name: link }} />
</span>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const labelRenderer: LabelRenderer = (displayedName, total, seeMoreHref) => {
return (
<FormattedMessage
id='notification.favourite'
defaultMessage='{name} favorited your status'
defaultMessage='{name} favorited your post'
values={{ name: displayedName }}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { navigateToStatus } from 'mastodon/actions/statuses';
import type { IconProp } from 'mastodon/components/icon';
import { Icon } from 'mastodon/components/icon';
import { RelativeTimestamp } from 'mastodon/components/relative_timestamp';
import { useAppDispatch } from 'mastodon/store';
import { useAppSelector, useAppDispatch } from 'mastodon/store';

import { AvatarGroup } from './avatar_group';
import { DisplayedName } from './displayed_name';
Expand Down Expand Up @@ -60,6 +60,10 @@ export const NotificationGroupWithStatus: React.FC<{
[labelRenderer, accountIds, count, labelSeeMoreHref],
);

const isPrivateMention = useAppSelector(
(state) => state.statuses.getIn([statusId, 'visibility']) === 'direct',
);

const handlers = useMemo(
() => ({
open: () => {
Expand All @@ -79,7 +83,10 @@ export const NotificationGroupWithStatus: React.FC<{
role='button'
className={classNames(
`notification-group focusable notification-group--${type}`,
{ 'notification-group--unread': unread },
{
'notification-group--unread': unread,
'notification-group--direct': isPrivateMention,
},
)}
tabIndex={0}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const labelRenderer: LabelRenderer = (displayedName, total, seeMoreHref) => {
return (
<FormattedMessage
id='notification.reblog'
defaultMessage='{name} boosted your status'
defaultMessage='{name} boosted your post'
values={{ name: displayedName }}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/features/ui/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const mapStateToProps = state => ({
isComposing: state.getIn(['compose', 'is_composing']),
hasComposingText: state.getIn(['compose', 'text']).trim().length !== 0,
hasMediaAttachments: state.getIn(['compose', 'media_attachments']).size > 0,
canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < 4,
canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < state.getIn(['server', 'server', 'configuration', 'statuses', 'max_media_attachments']),
firstLaunch: state.getIn(['settings', 'introductionVersion'], 0) < INTRODUCTION_VERSION,
username: state.getIn(['accounts', me, 'username']),
});
Expand Down
3 changes: 3 additions & 0 deletions app/javascript/mastodon/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
"block_modal.title": "Zablokovat uživatele?",
"block_modal.you_wont_see_mentions": "Neuvidíte příspěvky, které ho zmiňují.",
"boost_modal.combo": "Příště můžete pro přeskočení stisknout {combo}",
"boost_modal.reblog": "Boostnout příspěvek?",
"boost_modal.undo_reblog": "Zrušit boostování příspěvku?",
"bundle_column_error.copy_stacktrace": "Zkopírovat zprávu o chybě",
"bundle_column_error.error.body": "Požadovanou stránku nelze vykreslit. Může to být způsobeno chybou v našem kódu nebo problémem s kompatibilitou prohlížeče.",
"bundle_column_error.error.title": "Ale ne!",
Expand Down Expand Up @@ -192,6 +194,7 @@
"confirmations.unfollow.confirm": "Přestat sledovat",
"confirmations.unfollow.message": "Opravdu chcete {name} přestat sledovat?",
"confirmations.unfollow.title": "Přestat sledovat uživatele?",
"content_warning.hide": "Skrýt příspěvek",
"conversation.delete": "Smazat konverzaci",
"conversation.mark_as_read": "Označit jako přečtené",
"conversation.open": "Zobrazit konverzaci",
Expand Down
Loading

0 comments on commit a859b0c

Please sign in to comment.