Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024 08 10 1 Upstream Changes to Main #33

Merged
merged 99 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
19f4aa1
Fix typo in english message (filtred => filtered) (#31273)
renchap Aug 2, 2024
3d6e8d6
Disable irrelevant fields unless cleanup is enabled (#26562)
c960657 Aug 4, 2024
b6c1b8f
Fix missing border around tab/filter bar (#31286)
valtlai Aug 4, 2024
315308b
Fix duplicate border around search results (#31284)
valtlai Aug 4, 2024
3fec1ba
chore(deps): update devdependencies (non-major) (#31294)
renovate[bot] Aug 5, 2024
e99c0e6
chore(deps): update dependency @types/ws to v8.5.12 (#31293)
renovate[bot] Aug 5, 2024
f33049f
chore(deps): update dependency ffmpeg to v7.0.2 (#31289)
renovate[bot] Aug 5, 2024
3a36893
fix(deps): update dependency core-js to v3.38.0 (#31290)
renovate[bot] Aug 5, 2024
176d1fe
chore(deps): update yarn to v4.4.0 (#31274)
renovate[bot] Aug 5, 2024
9e440be
chore(deps): update dependency aws-sdk-s3 to v1.157.0 (#31252)
renovate[bot] Aug 5, 2024
29d6310
chore(deps): update dependency sidekiq-scheduler to v5.0.6 (#31245)
renovate[bot] Aug 5, 2024
02c2222
fix(deps): update dependency postcss-preset-env to v10 (#31279)
renovate[bot] Aug 5, 2024
a1eaf12
chore(deps): update dependency fog-core to '<= 2.5.0' (#31267)
renovate[bot] Aug 5, 2024
cb56a6d
New Crowdin Translations (automated) (#31276)
github-actions[bot] Aug 5, 2024
6563738
chore(deps): update dependency bootsnap to v1.18.4 (#31297)
renovate[bot] Aug 5, 2024
c01a6a6
Improve look of verified header fields in profile (#31275)
valtlai Aug 5, 2024
97b9e8b
Add account notes to hover cards (#31300)
renchap Aug 6, 2024
d15f46a
New Crowdin Translations (automated) (#31307)
github-actions[bot] Aug 6, 2024
135493c
chore(deps): update dependency rubocop-rspec to v3.0.4 (#31301)
renovate[bot] Aug 6, 2024
e9e63ed
Support JSON-LD named graph (#31288)
c960657 Aug 6, 2024
103e544
fix(deps): update dependency @reduxjs/toolkit to v2.2.7 - abandoned (…
renovate[bot] Aug 6, 2024
9d0cafd
Check Content-Length in ResponseWithLimitAdapter (#31285)
c960657 Aug 6, 2024
5d890eb
Delete pending notification requests on block and notification mutes …
ClearlyClaire Aug 6, 2024
438dac9
Add option to request partial accounts in grouped notifications API (…
ClearlyClaire Aug 6, 2024
57a1f86
Remove usage of non-public RTK types (#31312)
renchap Aug 6, 2024
30430a6
Fix broken “mute” button in mutes list (#31315)
ClearlyClaire Aug 6, 2024
c8b9e60
Fix mutes and blocks not immediately cleaning up notification request…
ClearlyClaire Aug 6, 2024
08adca0
Merge commit 'c8b9e60ec123c458efff83eedcfd07f067ef05ae' into glitch-s…
ClearlyClaire Aug 6, 2024
700ebdb
[Glitch] Fix typo in english message (filtred => filtered)
renchap Aug 2, 2024
5cdc0c2
[Glitch] Disable irrelevant fields unless cleanup is enabled
c960657 Aug 4, 2024
c5b7f48
[Glitch] Fix missing border around tab/filter bar
valtlai Aug 4, 2024
316132b
[Glitch] Fix duplicate border around search results
valtlai Aug 4, 2024
ad786cb
[Glitch] Improve look of verified header fields in profile
valtlai Aug 5, 2024
01b4c99
[Glitch] Add account notes to hover cards
renchap Aug 6, 2024
f0f2ce2
[Glitch] fix(deps): update dependency @reduxjs/toolkit to v2.2.7 - ab…
renovate[bot] Aug 6, 2024
7bb171a
[Glitch] Remove usage of non-public RTK types
renchap Aug 6, 2024
1c91b36
[Glitch] Fix broken “mute” button in mutes list
ClearlyClaire Aug 6, 2024
4354665
[Glitch] Fix mutes and blocks not immediately cleaning up notificatio…
ClearlyClaire Aug 6, 2024
241d760
Merge pull request #2806 from ClearlyClaire/glitch-soc/merge-upstream
ClearlyClaire Aug 7, 2024
719cabe
Fix logic of block/mute bypass for mentions from moderators (#31271)
ClearlyClaire Aug 7, 2024
fc964c9
New Crowdin Translations (automated) (#31321)
github-actions[bot] Aug 7, 2024
af2aec1
Change notification requests to only count mentions (#31322)
ClearlyClaire Aug 7, 2024
6f285bb
Change group notifications unread markers to only be cleared when foc…
ClearlyClaire Aug 7, 2024
670e465
Change dismissing a notification to clear existing filtered notificat…
ClearlyClaire Aug 7, 2024
06e034d
Merge commit '670e4655d13975e0597bd1c74ebeeeeffc4edc37' into glitch-s…
ClearlyClaire Aug 7, 2024
56b2801
[Glitch] Change group notifications unread markers to only be cleared…
ClearlyClaire Aug 7, 2024
e4e1173
Merge pull request #2807 from ClearlyClaire/glitch-soc/merge-upstream
ClearlyClaire Aug 7, 2024
abc4ed4
Replace more `font-awesome` icons in navigation sidebar area (#30974)
mjankowski Aug 7, 2024
e4092cc
Replace more `font-awesome` icons in `views/settings` (#30963)
mjankowski Aug 7, 2024
52a626f
Replace more `font-awesome` icons in `app/helpers` (#30962)
mjankowski Aug 7, 2024
84c3cc4
Replace more `font-awesome` icons in `views/admin` area (#30961)
mjankowski Aug 7, 2024
f862936
Add unchangeable filtered notification setting for limited accounts (…
ClearlyClaire Aug 7, 2024
ac9040b
Add explainer for filtered notifications from limited accounts (#31331)
ClearlyClaire Aug 8, 2024
176ba98
Follow up tweaking of admin UI changes part 2 (#31268)
vmstan Aug 8, 2024
a95fe93
Really fix duplicate border around search results (#31305)
valtlai Aug 8, 2024
2edae5e
Convert PrivacyDropdownMenu to Typescript and generalize it to Dropdo…
ClearlyClaire Aug 8, 2024
0e4d3c0
New Crowdin Translations (automated) (#31337)
github-actions[bot] Aug 8, 2024
079d681
Fix uninitialized grouped notifications read marker on initial load (…
ClearlyClaire Aug 8, 2024
dd2a991
Merge commit '079d681ac6f279f3a7a6be5c3734549f3be8f912' into glitch-s…
ClearlyClaire Aug 8, 2024
664bef3
Fix styling issues with notification settings and mobile borders (#31…
vmstan Aug 8, 2024
15dc195
[Glitch] Add material design icons to admin/settings views
mjankowski Apr 23, 2024
48e4c57
[Glitch] Replace more `font-awesome` icons in `views/admin` area
mjankowski Aug 7, 2024
ca6ad45
[Glitch] Add unchangeable filtered notification setting for limited a…
ClearlyClaire Aug 7, 2024
3ef5adc
[Glitch] Add explainer for filtered notifications from limited accounts
ClearlyClaire Aug 8, 2024
e01f437
[Glitch] Follow up tweaking of admin UI changes part 2
vmstan Aug 8, 2024
eacfb9f
[Glitch] Really fix duplicate border around search results
valtlai Aug 8, 2024
29db81e
[Glitch] Convert PrivacyDropdownMenu to Typescript and generalize it …
ClearlyClaire Aug 8, 2024
dad9baa
[Glitch] Fix uninitialized grouped notifications read marker on initi…
ClearlyClaire Aug 8, 2024
42c9488
Merge pull request #2808 from ClearlyClaire/glitch-soc/merge-upstream
ClearlyClaire Aug 8, 2024
a207a1f
Disable stylelint rules that are conflicting with Prettier (#31339)
renchap Aug 8, 2024
389549e
Fix list creation textbox styling (#31348)
vmstan Aug 8, 2024
f045ef8
Update dependency eslint-plugin-jsdoc to v50 (#31330)
renovate[bot] Aug 8, 2024
6e01a23
Update dependency eslint-plugin-promise to v7 (#31120)
renovate[bot] Aug 8, 2024
2095d0f
Update notification labels for mentions (#31304)
renchap Aug 8, 2024
6ca731e
Change unread notification count to only cover the selected notificat…
ClearlyClaire Aug 8, 2024
9538d9c
Fix post filter & report styling (#31349)
vmstan Aug 9, 2024
9bae237
Change confirmation prompt on trending management (#19626)
tribela Aug 9, 2024
994ef16
Bust CDN cache on media deletion (#31353)
ClearlyClaire Aug 9, 2024
e29c401
Add lang attribute on preview card title (#31303)
c960657 Aug 9, 2024
cbdd8ed
Revamp notification policy options (#31343)
ClearlyClaire Aug 9, 2024
8a5b57f
Revert "Support JSON-LD named graph (#31288)" (#31355)
ClearlyClaire Aug 9, 2024
1701575
Add option to ignore filtered notifications to the web interface (#31…
ClearlyClaire Aug 9, 2024
eaedd52
Fix incorrect rate limit on PUT requests (#31356)
ClearlyClaire Aug 9, 2024
658addc
Add ability to report, block and mute from notification requests list…
ClearlyClaire Aug 9, 2024
31a00c0
Merge commit '658addcbf783f6baa922d11c9524ebb9ddbcbc59' into glitch-s…
ClearlyClaire Aug 9, 2024
cc2949b
[Glitch] Fix styling issues with notification settings and mobile bor…
vmstan Aug 8, 2024
e7be55f
[Glitch] Fix list creation textbox styling
vmstan Aug 8, 2024
5a9f526
[Glitch] Update notification labels for mentions
renchap Aug 8, 2024
ce9715d
[Glitch] Change unread notification count to only cover the selected …
ClearlyClaire Aug 8, 2024
99d3816
[Glitch] Fix post filter & report styling
vmstan Aug 9, 2024
58b9b80
[Glitch] Add option to ignore filtered notifications to the web inter…
ClearlyClaire Aug 9, 2024
b6961d0
[Glitch] Add ability to report, block and mute from notification requ…
ClearlyClaire Aug 9, 2024
bcec8f5
Add hint to user that other remote statuses may not be displayed (#26…
audiodude Aug 9, 2024
28411ac
Fix “Accept all”/“Dismiss all” notification requests not working (#31…
ClearlyClaire Aug 9, 2024
f43a484
Merge commit '28411acebb5626acf43b44a7b6c33ac783156f72' into glitch-s…
ClearlyClaire Aug 9, 2024
57a6307
[Glitch] Add hint to user that other remote statuses may not be displ…
audiodude Aug 9, 2024
082c71f
[Glitch] Fix “Accept all”/“Dismiss all” notification requests not wor…
ClearlyClaire Aug 9, 2024
e6feabf
Merge pull request #2809 from ClearlyClaire/glitch-soc/merge-upstream
ClearlyClaire Aug 9, 2024
290902f
Merge pull request #32 from glitch-soc/main
nomad-geek Aug 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ FROM build AS ffmpeg

# ffmpeg version to compile, change with [--build-arg FFMPEG_VERSION="7.0.x"]
# renovate: datasource=repology depName=ffmpeg packageName=openpkg_current/ffmpeg
ARG FFMPEG_VERSION=7.0.1
ARG FFMPEG_VERSION=7.0.2
# ffmpeg download URL, change with [--build-arg FFMPEG_URL="https://ffmpeg.org/releases"]
ARG FFMPEG_URL=https://ffmpeg.org/releases

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ gem 'pghero'

gem 'aws-sdk-s3', '~> 1.123', require: false
gem 'blurhash', '~> 0.1'
gem 'fog-core', '<= 2.4.0'
gem 'fog-core', '<= 2.5.0'
gem 'fog-openstack', '~> 1.0', require: false
gem 'kt-paperclip', '~> 7.2'
gem 'md-paperclip-azure', '~> 2.2', require: false
Expand Down
22 changes: 11 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,20 @@ GEM
attr_required (1.0.2)
awrence (1.2.1)
aws-eventstream (1.3.0)
aws-partitions (1.950.0)
aws-sdk-core (3.201.0)
aws-partitions (1.961.0)
aws-sdk-core (3.201.3)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.88.0)
aws-sdk-core (~> 3, >= 3.201.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.156.0)
aws-sdk-s3 (1.157.0)
aws-sdk-core (~> 3, >= 3.201.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.8.0)
aws-sigv4 (1.9.1)
aws-eventstream (~> 1, >= 1.0.2)
azure-storage-blob (2.0.3)
azure-storage-common (~> 2.0)
Expand All @@ -135,7 +135,7 @@ GEM
binding_of_caller (1.0.1)
debug_inspector (>= 1.2.0)
blurhash (0.1.7)
bootsnap (1.18.3)
bootsnap (1.18.4)
msgpack (~> 1.2)
brakeman (6.1.2)
racc
Expand Down Expand Up @@ -229,7 +229,7 @@ GEM
erubi (1.13.0)
et-orbi (1.2.11)
tzinfo
excon (0.110.0)
excon (0.111.0)
fabrication (2.31.0)
faker (3.4.2)
i18n (>= 1.8.11, < 2)
Expand Down Expand Up @@ -269,7 +269,7 @@ GEM
flatware-rspec (2.3.2)
flatware (= 2.3.2)
rspec (>= 3.6)
fog-core (2.4.0)
fog-core (2.5.0)
builder
excon (~> 0.71)
formatador (>= 0.2, < 2.0)
Expand Down Expand Up @@ -429,7 +429,7 @@ GEM
memory_profiler (1.0.2)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0604)
mime-types-data (3.2024.0702)
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.24.1)
Expand Down Expand Up @@ -758,7 +758,7 @@ GEM
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.3)
rubocop-rspec (3.0.4)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
Expand Down Expand Up @@ -796,7 +796,7 @@ GEM
redis (>= 4.5.0, < 5)
sidekiq-bulk (0.2.0)
sidekiq
sidekiq-scheduler (5.0.5)
sidekiq-scheduler (5.0.6)
rufus-scheduler (~> 3.2)
sidekiq (>= 6, < 8)
tilt (>= 1.4.0, < 3)
Expand Down Expand Up @@ -945,7 +945,7 @@ DEPENDENCIES
fast_blank (~> 1.0)
fastimage
flatware-rspec
fog-core (<= 2.4.0)
fog-core (<= 2.5.0)
fog-openstack (~> 1.0)
fuubar (~> 2.5)
haml-rails (~> 2.0)
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/api/v1/notifications/policies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ class Api::V1::Notifications::PoliciesController < Api::BaseController
before_action :set_policy

def show
render json: @policy, serializer: REST::NotificationPolicySerializer
render json: @policy, serializer: REST::V1::NotificationPolicySerializer
end

def update
@policy.update!(resource_params)
render json: @policy, serializer: REST::NotificationPolicySerializer
render json: @policy, serializer: REST::V1::NotificationPolicySerializer
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def accept
end

def dismiss
@request.destroy!
DismissNotificationRequestService.new.call(@request)
render_empty
end

Expand Down
38 changes: 38 additions & 0 deletions app/controllers/api/v2/notifications/policies_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# frozen_string_literal: true

class Api::V2::Notifications::PoliciesController < Api::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:notifications' }, only: :show
before_action -> { doorkeeper_authorize! :write, :'write:notifications' }, only: :update

before_action :require_user!
before_action :set_policy

def show
render json: @policy, serializer: REST::NotificationPolicySerializer
end

def update
@policy.update!(resource_params)
render json: @policy, serializer: REST::NotificationPolicySerializer
end

private

def set_policy
@policy = NotificationPolicy.find_or_initialize_by(account: current_account)

with_read_replica do
@policy.summarize!
end
end

def resource_params
params.permit(
:for_not_following,
:for_not_followers,
:for_new_accounts,
:for_private_mentions,
:for_limited_accounts
)
end
end
25 changes: 18 additions & 7 deletions app/controllers/api/v2_alpha/notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ def index
@group_metadata = load_group_metadata
@grouped_notifications = load_grouped_notifications
@relationships = StatusRelationshipsPresenter.new(target_statuses_from_notifications, current_user&.account_id)
@sample_accounts = @grouped_notifications.flat_map(&:sample_accounts)
@presenter = GroupedNotificationsPresenter.new(@grouped_notifications, expand_accounts: expand_accounts_param)

# Preload associations to avoid N+1s
ActiveRecord::Associations::Preloader.new(records: @sample_accounts, associations: [:account_stat, { user: :role }]).call
ActiveRecord::Associations::Preloader.new(records: @presenter.accounts, associations: [:account_stat, { user: :role }]).call
end

MastodonOTELTracer.in_span('Api::V2Alpha::NotificationsController#index rendering') do |span|
statuses = @grouped_notifications.filter_map { |group| group.target_status&.id }

span.add_attributes(
'app.notification_grouping.count' => @grouped_notifications.size,
'app.notification_grouping.sample_account.count' => @sample_accounts.size,
'app.notification_grouping.sample_account.unique_count' => @sample_accounts.pluck(:id).uniq.size,
'app.notification_grouping.account.count' => @presenter.accounts.size,
'app.notification_grouping.partial_account.count' => @presenter.partial_accounts.size,
'app.notification_grouping.status.count' => statuses.size,
'app.notification_grouping.status.unique_count' => statuses.uniq.size
'app.notification_grouping.status.unique_count' => statuses.uniq.size,
'app.notification_grouping.expand_accounts_param' => expand_accounts_param
)

presenter = GroupedNotificationsPresenter.new(@grouped_notifications)
render json: presenter, serializer: REST::DedupNotificationGroupSerializer, relationships: @relationships, group_metadata: @group_metadata
render json: @presenter, serializer: REST::DedupNotificationGroupSerializer, relationships: @relationships, group_metadata: @group_metadata, expand_accounts: expand_accounts_param
end
end

Expand Down Expand Up @@ -131,4 +131,15 @@ def browserable_params
def pagination_params(core_params)
params.slice(:limit, :types, :exclude_types, :include_filtered).permit(:limit, :include_filtered, types: [], exclude_types: []).merge(core_params)
end

def expand_accounts_param
case params[:expand_accounts]
when nil, 'full'
'full'
when 'partial_avatars'
'partial_avatars'
else
raise Mastodon::InvalidParameterError, "Invalid value for 'expand_accounts': '#{params[:expand_accounts]}', allowed values are 'full' and 'partial_avatars'"
end
end
end
16 changes: 8 additions & 8 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def fa_icon(icon, attributes = {})
def material_symbol(icon, attributes = {})
inline_svg_tag(
"400-24px/#{icon}.svg",
class: %w(icon).concat(attributes[:class].to_s.split),
class: ['icon', "material-#{icon}"].concat(attributes[:class].to_s.split),
role: :img
)
end
Expand All @@ -127,23 +127,23 @@ def check_icon

def visibility_icon(status)
if status.public_visibility?
fa_icon('globe', title: I18n.t('statuses.visibilities.public'))
material_symbol('globe', title: I18n.t('statuses.visibilities.public'))
elsif status.unlisted_visibility?
fa_icon('unlock', title: I18n.t('statuses.visibilities.unlisted'))
material_symbol('lock_open', title: I18n.t('statuses.visibilities.unlisted'))
elsif status.private_visibility? || status.limited_visibility?
fa_icon('lock', title: I18n.t('statuses.visibilities.private'))
material_symbol('lock', title: I18n.t('statuses.visibilities.private'))
elsif status.direct_visibility?
fa_icon('at', title: I18n.t('statuses.visibilities.direct'))
material_symbol('alternate_email', title: I18n.t('statuses.visibilities.direct'))
end
end

def interrelationships_icon(relationships, account_id)
if relationships.following[account_id] && relationships.followed_by[account_id]
fa_icon('exchange', title: I18n.t('relationships.mutual'), class: 'fa-fw active passive')
material_symbol('sync_alt', title: I18n.t('relationships.mutual'), class: 'active passive')
elsif relationships.following[account_id]
fa_icon(locale_direction == 'ltr' ? 'arrow-right' : 'arrow-left', title: I18n.t('relationships.following'), class: 'fa-fw active')
material_symbol(locale_direction == 'ltr' ? 'arrow_right_alt' : 'arrow_left_alt', title: I18n.t('relationships.following'), class: 'active')
elsif relationships.followed_by[account_id]
fa_icon(locale_direction == 'ltr' ? 'arrow-left' : 'arrow-right', title: I18n.t('relationships.followers'), class: 'fa-fw passive')
material_symbol(locale_direction == 'ltr' ? 'arrow_left_alt' : 'arrow_right_alt', title: I18n.t('relationships.followers'), class: 'passive')
end
end

Expand Down
8 changes: 4 additions & 4 deletions app/helpers/statuses_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ def stream_link_target
def fa_visibility_icon(status)
case status.visibility
when 'public'
fa_icon 'globe fw'
material_symbol 'globe'
when 'unlisted'
fa_icon 'unlock fw'
material_symbol 'lock_open'
when 'private'
fa_icon 'lock fw'
material_symbol 'lock'
when 'direct'
fa_icon 'at fw'
material_symbol 'alternate_email'
end
end

Expand Down
36 changes: 36 additions & 0 deletions app/javascript/entrypoints/public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,42 @@ Rails.delegate(document, 'img.custom-emoji', 'mouseout', ({ target }) => {
target.src = target.dataset.static;
});

const setInputDisabled = (
input: HTMLInputElement | HTMLSelectElement,
disabled: boolean,
) => {
input.disabled = disabled;

const wrapper = input.closest('.with_label');
if (wrapper) {
wrapper.classList.toggle('disabled', input.disabled);

const hidden =
input.type === 'checkbox' &&
wrapper.querySelector<HTMLInputElement>('input[type=hidden][value="0"]');
if (hidden) {
hidden.disabled = input.disabled;
}
}
};

Rails.delegate(
document,
'#account_statuses_cleanup_policy_enabled',
'change',
({ target }) => {
if (!(target instanceof HTMLInputElement) || !target.form) return;

target.form
.querySelectorAll<
HTMLInputElement | HTMLSelectElement
>('input:not([type=hidden], #account_statuses_cleanup_policy_enabled), select')
.forEach((input) => {
setInputDisabled(input, !target.checked);
});
},
);

// Empty the honeypot fields in JS in case something like an extension
// automatically filled them.
Rails.delegate(document, '#registration_new_user,#new_user', 'submit', () => {
Expand Down
64 changes: 64 additions & 0 deletions app/javascript/flavours/glitch/actions/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ export const NOTIFICATION_REQUEST_DISMISS_REQUEST = 'NOTIFICATION_REQUEST_DISMIS
export const NOTIFICATION_REQUEST_DISMISS_SUCCESS = 'NOTIFICATION_REQUEST_DISMISS_SUCCESS';
export const NOTIFICATION_REQUEST_DISMISS_FAIL = 'NOTIFICATION_REQUEST_DISMISS_FAIL';

export const NOTIFICATION_REQUESTS_ACCEPT_REQUEST = 'NOTIFICATION_REQUESTS_ACCEPT_REQUEST';
export const NOTIFICATION_REQUESTS_ACCEPT_SUCCESS = 'NOTIFICATION_REQUESTS_ACCEPT_SUCCESS';
export const NOTIFICATION_REQUESTS_ACCEPT_FAIL = 'NOTIFICATION_REQUESTS_ACCEPT_FAIL';

export const NOTIFICATION_REQUESTS_DISMISS_REQUEST = 'NOTIFICATION_REQUESTS_DISMISS_REQUEST';
export const NOTIFICATION_REQUESTS_DISMISS_SUCCESS = 'NOTIFICATION_REQUESTS_DISMISS_SUCCESS';
export const NOTIFICATION_REQUESTS_DISMISS_FAIL = 'NOTIFICATION_REQUESTS_DISMISS_FAIL';

export const NOTIFICATIONS_FOR_REQUEST_FETCH_REQUEST = 'NOTIFICATIONS_FOR_REQUEST_FETCH_REQUEST';
export const NOTIFICATIONS_FOR_REQUEST_FETCH_SUCCESS = 'NOTIFICATIONS_FOR_REQUEST_FETCH_SUCCESS';
export const NOTIFICATIONS_FOR_REQUEST_FETCH_FAIL = 'NOTIFICATIONS_FOR_REQUEST_FETCH_FAIL';
Expand Down Expand Up @@ -584,6 +592,62 @@ export const dismissNotificationRequestFail = (id, error) => ({
error,
});

export const acceptNotificationRequests = (ids) => (dispatch, getState) => {
const count = ids.reduce((count, id) => count + selectNotificationCountForRequest(getState(), id), 0);
dispatch(acceptNotificationRequestsRequest(ids));

api().post(`/api/v1/notifications/requests/accept`, { id: ids }).then(() => {
dispatch(acceptNotificationRequestsSuccess(ids));
dispatch(decreasePendingNotificationsCount(count));
}).catch(err => {
dispatch(acceptNotificationRequestFail(ids, err));
});
};

export const acceptNotificationRequestsRequest = ids => ({
type: NOTIFICATION_REQUESTS_ACCEPT_REQUEST,
ids,
});

export const acceptNotificationRequestsSuccess = ids => ({
type: NOTIFICATION_REQUESTS_ACCEPT_SUCCESS,
ids,
});

export const acceptNotificationRequestsFail = (ids, error) => ({
type: NOTIFICATION_REQUESTS_ACCEPT_FAIL,
ids,
error,
});

export const dismissNotificationRequests = (ids) => (dispatch, getState) => {
const count = ids.reduce((count, id) => count + selectNotificationCountForRequest(getState(), id), 0);
dispatch(acceptNotificationRequestsRequest(ids));

api().post(`/api/v1/notifications/requests/dismiss`, { id: ids }).then(() => {
dispatch(dismissNotificationRequestsSuccess(ids));
dispatch(decreasePendingNotificationsCount(count));
}).catch(err => {
dispatch(dismissNotificationRequestFail(ids, err));
});
};

export const dismissNotificationRequestsRequest = ids => ({
type: NOTIFICATION_REQUESTS_DISMISS_REQUEST,
ids,
});

export const dismissNotificationRequestsSuccess = ids => ({
type: NOTIFICATION_REQUESTS_DISMISS_SUCCESS,
ids,
});

export const dismissNotificationRequestsFail = (ids, error) => ({
type: NOTIFICATION_REQUESTS_DISMISS_FAIL,
ids,
error,
});

export const fetchNotificationsForRequest = accountId => (dispatch, getState) => {
const current = getState().getIn(['notificationRequests', 'current']);
const params = { account_id: accountId };
Expand Down
Loading
Loading