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 02 3 Merge in changes #31

Merged
merged 96 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
3a49687
Fix performance issue by using LATERAL in group notification CTE (#31…
ClearlyClaire Jul 24, 2024
9e04007
chore(deps): update opentelemetry-ruby (non-major) (#31126)
renovate[bot] Jul 24, 2024
8117977
fix(deps): update dependency postcss to v8.4.40 (#31137)
renovate[bot] Jul 25, 2024
9c39fb5
chore(deps): update opentelemetry-ruby (non-major) (#31138)
renovate[bot] Jul 25, 2024
ef0e3e4
New Crowdin Translations (automated) (#31119)
github-actions[bot] Jul 25, 2024
efa7ad9
chore(deps): update dependency node to 20.16 (#31127)
renovate[bot] Jul 25, 2024
4d374cf
chore(deps): update dependency opentelemetry-exporter-otlp to v0.28.1…
renovate[bot] Jul 25, 2024
34626b8
Update schema to reflect full `db:migrate` run results (#31128)
mjankowski Jul 25, 2024
c94c5da
Merge commit '4d374cf73096be1e5347e131c91c99842e3c6dbb' into glitch-s…
ClearlyClaire Jul 25, 2024
e881a59
Add `User.unconfirmed` scope, reduce factories in `scheduler/user_cle…
mjankowski Jul 25, 2024
337a7fc
Fix ß bug in regexp for mentions and tags (#31122)
adamniedzielski Jul 25, 2024
bfaa533
Improve failure message on pagination matcher (#31146)
mjankowski Jul 25, 2024
fbf9521
Fix LinkCrawlWorker NoMethodError: undefined method `[]' for nil (#31…
adamniedzielski Jul 25, 2024
5f53733
Remove duplicate `omniauth_only?` helper method (#31066)
mjankowski Jul 25, 2024
887e64e
Allow @ at the end of an URL (#31124)
adamniedzielski Jul 25, 2024
ff6d2ec
fix(deps): update dependency pino to v9.3.2 (#31148)
renovate[bot] Jul 25, 2024
836719e
Merge pull request #2796 from ClearlyClaire/glitch-soc/merge-upstream
ClearlyClaire Jul 25, 2024
cf5d2c3
Merge commit '887e64efd4abbf3980e008c7a5441b44fbd6c766' into glitch-s…
ClearlyClaire Jul 25, 2024
8818748
Change design of confirmation modals in web UI (#30884)
Gargron Jul 25, 2024
8af71d0
Merge pull request #2797 from ClearlyClaire/glitch-soc/merge-upstream
ClearlyClaire Jul 25, 2024
3793c84
New Crowdin Translations (automated) (#31154)
github-actions[bot] Jul 26, 2024
693d9b0
Enable OAuth PKCE Extension (#31129)
ThisIsMissEm Jul 26, 2024
c091fa7
chore(deps): update devdependencies (non-major) (#31096)
renovate[bot] Jul 26, 2024
dfd4386
Decrease count of filtered notifications when notification requests …
oneiros Jul 26, 2024
b120792
Adjust ffmpeg version detection in admin panel (#31130)
vmstan Jul 26, 2024
dd53792
Move UI tests from controller to system spec (#31158)
oneiros Jul 26, 2024
fb411b6
Merge commit 'dd5379271410219de0806bb33e7cdfa427ea6988' into glitch-s…
ClearlyClaire Jul 27, 2024
14bc73e
[Glitch] Change design of confirmation modals in web UI
Gargron Jul 25, 2024
0e18e1b
[Glitch] Decrease count of filtered notifications when notification r…
oneiros Jul 26, 2024
e79b2a7
Merge pull request #2798 from ClearlyClaire/glitch-soc/merge-upstream
ClearlyClaire Jul 27, 2024
90d6297
chore(deps): update eslint (non-major) (#31188)
renovate[bot] Jul 29, 2024
cefd8b5
chore(deps): update dependency husky to v9.1.3 (#31185)
renovate[bot] Jul 29, 2024
4cc634d
fix(deps): update dependency use-debounce to v10.0.2 (#31177)
renovate[bot] Jul 29, 2024
37f5718
chore(deps): update dependency sanitize to v6.1.2 (#31172)
renovate[bot] Jul 29, 2024
848a5ca
Follow up tweaking of admin UI changes (#31168)
vmstan Jul 29, 2024
ec5a860
New Crowdin Translations (automated) (#31169)
github-actions[bot] Jul 29, 2024
6ad477d
Fix Codespaces startup fails due to Corepack download prompt (#31189)
kyori19 Jul 29, 2024
95eadab
Extrude `fill_in_auth_details` method to `ProfileStories` spec suppor…
mjankowski Jul 29, 2024
8edd77a
chore(deps): update dependency typescript to v5.5.4 (#31186)
renovate[bot] Jul 29, 2024
91fbd5b
Adjust magick version detection in admin panel (#30845)
vmstan Jul 29, 2024
6d2ed0d
chore(deps): update dependency pg to v1.5.7 (#31176)
renovate[bot] Jul 29, 2024
c40e481
Implement UI for Admin Search of Hashtags (#30880)
ThisIsMissEm Jul 29, 2024
1229d29
chore(deps): update docker/dockerfile docker tag to v1.9 (#31187)
renovate[bot] Jul 29, 2024
654187a
Merge commit '1229d2907a4a7ee09ee42cd24043d74561507e0a' into glitch-s…
ClearlyClaire Jul 29, 2024
7e33583
Dont run crowdin upload workflow on forks (#31195)
mjankowski Jul 29, 2024
eae81d3
[Glitch] Follow up tweaking of admin UI changes
vmstan Jul 29, 2024
ceb7972
[Glitch] Implement UI for Admin Search of Hashtags
ThisIsMissEm Jul 29, 2024
25c6b52
Merge pull request #2800 from ClearlyClaire/glitch-soc/merge-upstream
ClearlyClaire Jul 29, 2024
e1f7ca7
chore(deps): update dependency json-ld to v3.3.2 (#31205)
renovate[bot] Jul 30, 2024
7d11a6c
New Crowdin Translations (automated) (#31206)
github-actions[bot] Jul 30, 2024
2ce99c5
Fixed Rails route covering %40-encoded profile URL paths to not 404 (…
timothyjrogers Jul 30, 2024
598ae4f
Add endpoints for unread notifications count (#31191)
ClearlyClaire Jul 30, 2024
1f796d1
Merge commit '598ae4f2da86029b1c3c3e35e64b89873037b598' into glitch-s…
ClearlyClaire Jul 30, 2024
4eab6ae
Change User-Agent to use Mastodon as the product, and http.rb as plat…
ClearlyClaire Jul 30, 2024
3271765
Merge pull request #2801 from ClearlyClaire/glitch-soc/merge-upstream
ClearlyClaire Jul 31, 2024
fd1bade
Fix inconsistent dismiss icon for notification requests (#31220)
ClearlyClaire Jul 31, 2024
66a16bf
chore(deps): update dependency opentelemetry-instrumentation-active_j…
renovate[bot] Jul 31, 2024
520ff04
New Crowdin Translations (automated) (#31219)
github-actions[bot] Jul 31, 2024
288961b
Change private mention icon for consistency in grouped notifications …
ClearlyClaire Jul 31, 2024
549ab08
Change grouped notifications API shape (take 2) (#31214)
ClearlyClaire Jul 31, 2024
2c1e757
Change filtered notification banner design to take up less space (#31…
ClearlyClaire Jul 31, 2024
a50c8e9
Fix issue with grouped notifications UI due to recent API change (#31…
ClearlyClaire Jul 31, 2024
8dd671a
Merge commit 'a50c8e951f03a8eb53957ad1c3703155b223ed24' into glitch-s…
ClearlyClaire Jul 31, 2024
2be70ae
[Glitch] Fix inconsistent dismiss icon for notification requests
ClearlyClaire Jul 31, 2024
de1ef5b
[Glitch] Change private mention icon for consistency in grouped notif…
ClearlyClaire Jul 31, 2024
feed816
[Glitch] Change grouped notifications API shape (take 2)
ClearlyClaire Jul 31, 2024
de8a31f
[Glitch] Change filtered notification banner design to take up less s…
ClearlyClaire Jul 31, 2024
49ad147
[Glitch] Fix issue with grouped notifications UI due to recent API ch…
ClearlyClaire Jul 31, 2024
a9ffec4
Merge pull request #2803 from ClearlyClaire/glitch-soc/merge-upstream
ClearlyClaire Jul 31, 2024
f6dc8ae
Fix handling of long display names in notification requests (#31225)
ClearlyClaire Aug 1, 2024
06c3a41
chore(deps): update dependency rubocop to v1.65.1 (#31239)
renovate[bot] Aug 1, 2024
4853a2b
Add Accept-Language header when fetching preview card (#31232)
c960657 Aug 1, 2024
584b152
New Crowdin Translations (automated) (#31237)
github-actions[bot] Aug 1, 2024
da5b45a
Add endpoints to accept and dismiss multiple notification requests at…
ClearlyClaire Aug 1, 2024
afdfeb5
Fix click event handling when clicking outside of an open dropdown me…
ClearlyClaire Aug 1, 2024
d19edc4
fix(deps): update dependency axios to v1.7.3 (#31248)
renovate[bot] Aug 2, 2024
f55099f
Increase maximum page size for Admin Domain Management APIs (#31253)
ThisIsMissEm Aug 2, 2024
7490019
Fix support for IPv6 redis connections in streaming (#31229)
ThisIsMissEm Aug 2, 2024
caeae25
New Crowdin Translations (automated) (#31261)
github-actions[bot] Aug 2, 2024
6a27a8c
fix(deps): update babel monorepo (#31167)
renovate[bot] Aug 2, 2024
2a704ad
Fix status processing failing halfway when a remote post has a malfor…
ClearlyClaire Aug 2, 2024
bb3941f
Change `DropdownMenu` component's `items` prop type (#31263)
ClearlyClaire Aug 2, 2024
99c446b
Change PostCSS config to allow logical properties (#31264)
renchap Aug 2, 2024
cc453f2
Change the filtered notification count to be in the account avatar (#…
renchap Aug 2, 2024
2ec1181
Fix contrast between background and form elements on some pages (#31266)
ClearlyClaire Aug 2, 2024
a8058f2
Merge pull request #29 from glitch-soc/main
nomad-geek Aug 2, 2024
ad95c98
Further de-emphasize filtered notifications banner and add setting to…
ClearlyClaire Aug 2, 2024
e67e072
Merge commit 'ad95c98054574080ac5d15584b3018d1db836531' into glitch-s…
ClearlyClaire Aug 2, 2024
80d3158
[Glitch] Fix handling of long display names in notification requests
ClearlyClaire Aug 1, 2024
7946d98
[Glitch] Fix click event handling when clicking outside of an open dr…
ClearlyClaire Aug 1, 2024
a51cdd6
[Glitch] Change `DropdownMenu` component's `items` prop type
ClearlyClaire Aug 2, 2024
61f5f5c
[Glitch] Change the filtered notification count to be in the account …
renchap Aug 2, 2024
f273671
[Glitch] Fix contrast between background and form elements on some pages
ClearlyClaire Aug 2, 2024
096f622
[Glitch] Further de-emphasize filtered notifications banner and add s…
ClearlyClaire Aug 2, 2024
a31ab56
Merge pull request #2804 from ClearlyClaire/glitch-soc/merge-upstream
ClearlyClaire Aug 2, 2024
e7dbf44
Merge pull request #30 from glitch-soc/main
nomad-geek Aug 3, 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 .devcontainer/codespaces/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},

"onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
"postCreateCommand": "bin/setup",
"postCreateCommand": "COREPACK_ENABLE_DOWNLOAD_PROMPT=0 bin/setup",
"waitFor": "postCreateCommand",

"customizations": {
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/crowdin-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
jobs:
upload-translations:
runs-on: ubuntu-latest
if: github.repository == 'mastodon/mastodon'

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.15
20.16
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.8
# syntax=docker/dockerfile:1.9

# This file is designed for production server deployment, not local development work
# For a containerized local dev environment, see: https://github.com/mastodon/mastodon/blob/main/README.md#docker
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ gem 'json-ld'
gem 'json-ld-preloaded', '~> 3.2'
gem 'rdf-normalize', '~> 0.5'

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

group :opentelemetry do
gem 'opentelemetry-exporter-otlp', '~> 0.28.0', require: false
Expand Down
58 changes: 30 additions & 28 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ GEM
ruby-progressbar (~> 1.4)
globalid (1.2.1)
activesupport (>= 6.1)
google-protobuf (3.25.3)
google-protobuf (3.25.4)
googleapis-common-protos-types (1.14.0)
google-protobuf (~> 3.18)
haml (6.3.0)
Expand Down Expand Up @@ -357,13 +357,14 @@ GEM
aes_key_wrap
bindata
httpclient
json-ld (3.3.1)
json-ld (3.3.2)
htmlentities (~> 4.3)
json-canonicalization (~> 1.0)
link_header (~> 0.0, >= 0.0.8)
multi_json (~> 1.15)
rack (>= 2.2, < 4)
rdf (~> 3.3)
rexml (~> 3.2)
json-ld-preloaded (3.3.0)
json-ld (~> 3.3)
rdf (~> 3.3)
Expand Down Expand Up @@ -451,7 +452,7 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.16.6)
nokogiri (1.16.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nsa (0.3.0)
Expand Down Expand Up @@ -492,10 +493,10 @@ GEM
openssl (3.2.0)
openssl-signature_algorithm (1.3.0)
openssl (> 2.0)
opentelemetry-api (1.2.5)
opentelemetry-api (1.3.0)
opentelemetry-common (0.20.1)
opentelemetry-api (~> 1.0)
opentelemetry-exporter-otlp (0.28.0)
opentelemetry-exporter-otlp (0.28.1)
google-protobuf (>= 3.18)
googleapis-common-protos-types (~> 1.3)
opentelemetry-api (~> 1.1)
Expand All @@ -512,14 +513,14 @@ GEM
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-rack (~> 0.21)
opentelemetry-instrumentation-action_view (0.7.0)
opentelemetry-instrumentation-action_view (0.7.1)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-active_support (~> 0.1)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-active_job (0.7.3)
opentelemetry-instrumentation-active_job (0.7.4)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-active_model_serializers (0.20.1)
opentelemetry-instrumentation-active_model_serializers (0.20.2)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-active_record (0.7.2)
Expand All @@ -531,32 +532,32 @@ GEM
opentelemetry-instrumentation-base (0.22.3)
opentelemetry-api (~> 1.0)
opentelemetry-registry (~> 0.1)
opentelemetry-instrumentation-concurrent_ruby (0.21.3)
opentelemetry-instrumentation-concurrent_ruby (0.21.4)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-excon (0.22.3)
opentelemetry-instrumentation-excon (0.22.4)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-faraday (0.24.5)
opentelemetry-instrumentation-faraday (0.24.6)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-http (0.23.3)
opentelemetry-instrumentation-http (0.23.4)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-http_client (0.22.6)
opentelemetry-instrumentation-http_client (0.22.7)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-net_http (0.22.6)
opentelemetry-instrumentation-net_http (0.22.7)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-pg (0.27.3)
opentelemetry-instrumentation-pg (0.27.4)
opentelemetry-api (~> 1.0)
opentelemetry-helpers-sql-obfuscation
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-rack (0.24.5)
opentelemetry-instrumentation-rack (0.24.6)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-rails (0.31.0)
opentelemetry-instrumentation-rails (0.31.1)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-action_mailer (~> 0.1.0)
opentelemetry-instrumentation-action_pack (~> 0.9.0)
Expand All @@ -565,20 +566,20 @@ GEM
opentelemetry-instrumentation-active_record (~> 0.7.0)
opentelemetry-instrumentation-active_support (~> 0.6.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-redis (0.25.6)
opentelemetry-instrumentation-redis (0.25.7)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-sidekiq (0.25.6)
opentelemetry-instrumentation-sidekiq (0.25.7)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-registry (0.3.1)
opentelemetry-api (~> 1.1)
opentelemetry-sdk (1.4.1)
opentelemetry-sdk (1.5.0)
opentelemetry-api (~> 1.1)
opentelemetry-common (~> 0.20)
opentelemetry-registry (~> 0.2)
opentelemetry-semantic_conventions
opentelemetry-semantic_conventions (1.10.0)
opentelemetry-semantic_conventions (1.10.1)
opentelemetry-api (~> 1.0)
orm_adapter (0.5.0)
ox (2.14.18)
Expand All @@ -589,7 +590,7 @@ GEM
parslet (2.0.0)
pastel (0.8.0)
tty-color (~> 0.5)
pg (1.5.6)
pg (1.5.7)
pghero (3.6.0)
activerecord (>= 6.1)
premailer (1.23.0)
Expand All @@ -613,7 +614,7 @@ GEM
pundit (2.3.2)
activesupport (>= 3.0.0)
raabro (1.4.0)
racc (1.8.0)
racc (1.8.1)
rack (2.2.9)
rack-attack (6.7.0)
rack (>= 1.0, < 4)
Expand Down Expand Up @@ -675,8 +676,9 @@ GEM
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.2.1)
rdf (3.3.1)
rdf (3.3.2)
bcp47_spec (~> 0.2)
bigdecimal (~> 3.1, >= 3.1.5)
link_header (~> 0.0, >= 0.0.8)
rdf-normalize (0.7.0)
rdf (~> 3.3)
Expand All @@ -696,7 +698,7 @@ GEM
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.3.2)
rexml (3.3.4)
strscan
rotp (6.3.0)
rouge (4.2.1)
Expand Down Expand Up @@ -733,7 +735,7 @@ GEM
rspec-mocks (~> 3.0)
sidekiq (>= 5, < 8)
rspec-support (3.13.1)
rubocop (1.65.0)
rubocop (1.65.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand Down Expand Up @@ -775,7 +777,7 @@ GEM
fugit (~> 1.1, >= 1.1.6)
safety_net_attestation (0.4.0)
jwt (~> 2.0)
sanitize (6.1.1)
sanitize (6.1.2)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
scenic (1.8.0)
Expand Down Expand Up @@ -983,7 +985,7 @@ DEPENDENCIES
omniauth-rails_csrf_protection (~> 1.0)
omniauth-saml (~> 2.0)
omniauth_openid_connect (~> 0.6.1)
opentelemetry-api (~> 1.2.5)
opentelemetry-api (~> 1.3.0)
opentelemetry-exporter-otlp (~> 0.28.0)
opentelemetry-instrumentation-active_job (~> 0.7.1)
opentelemetry-instrumentation-active_model_serializers (~> 0.20.1)
Expand Down
18 changes: 17 additions & 1 deletion app/controllers/admin/tags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

module Admin
class TagsController < BaseController
before_action :set_tag
before_action :set_tag, except: [:index]

PER_PAGE = 20

def index
authorize :tag, :index?

@tags = filtered_tags.page(params[:page]).per(PER_PAGE)
end

def show
authorize @tag, :show?
Expand Down Expand Up @@ -31,5 +39,13 @@ def set_tag
def tag_params
params.require(:tag).permit(:name, :display_name, :trendable, :usable, :listable)
end

def filtered_tags
TagFilter.new(filter_params.with_defaults(order: 'newest')).results
end

def filter_params
params.slice(:page, *TagFilter::KEYS).permit(:page, *TagFilter::KEYS)
end
end
end
4 changes: 2 additions & 2 deletions app/controllers/api/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def doorkeeper_forbidden_render_options(*)

protected

def limit_param(default_limit)
def limit_param(default_limit, max_limit = nil)
return default_limit unless params[:limit]

[params[:limit].to_i.abs, default_limit * 2].min
[params[:limit].to_i.abs, max_limit || (default_limit * 2)].min
end

def params_slice(*keys)
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/api/v1/admin/domain_allows_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Api::V1::Admin::DomainAllowsController < Api::BaseController
include AccountableConcern

LIMIT = 100
MAX_LIMIT = 500

before_action -> { authorize_if_got_token! :'admin:read', :'admin:read:domain_allows' }, only: [:index, :show]
before_action -> { authorize_if_got_token! :'admin:write', :'admin:write:domain_allows' }, except: [:index, :show]
Expand Down Expand Up @@ -47,7 +48,7 @@ def destroy
private

def set_domain_allows
@domain_allows = DomainAllow.order(id: :desc).to_a_paginated_by_id(limit_param(LIMIT), params_slice(:max_id, :since_id, :min_id))
@domain_allows = DomainAllow.order(id: :desc).to_a_paginated_by_id(limit_param(LIMIT, MAX_LIMIT), params_slice(:max_id, :since_id, :min_id))
end

def set_domain_allow
Expand All @@ -67,7 +68,7 @@ def pagination_collection
end

def records_continue?
@domain_allows.size == limit_param(LIMIT)
@domain_allows.size == limit_param(LIMIT, MAX_LIMIT)
end

def resource_params
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/api/v1/admin/domain_blocks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
include AccountableConcern

LIMIT = 100
MAX_LIMIT = 500

before_action -> { authorize_if_got_token! :'admin:read', :'admin:read:domain_blocks' }, only: [:index, :show]
before_action -> { authorize_if_got_token! :'admin:write', :'admin:write:domain_blocks' }, except: [:index, :show]
Expand Down Expand Up @@ -59,7 +60,7 @@ def conflicts_with_existing_block?(domain_block, existing_domain_block)
end

def set_domain_blocks
@domain_blocks = DomainBlock.order(id: :desc).to_a_paginated_by_id(limit_param(LIMIT), params_slice(:max_id, :since_id, :min_id))
@domain_blocks = DomainBlock.order(id: :desc).to_a_paginated_by_id(limit_param(LIMIT, MAX_LIMIT), params_slice(:max_id, :since_id, :min_id))
end

def set_domain_block
Expand All @@ -83,7 +84,7 @@ def pagination_collection
end

def records_continue?
@domain_blocks.size == limit_param(LIMIT)
@domain_blocks.size == limit_param(LIMIT, MAX_LIMIT)
end

def resource_params
Expand Down
17 changes: 16 additions & 1 deletion app/controllers/api/v1/notifications/requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class Api::V1::Notifications::RequestsController < Api::BaseController
before_action -> { doorkeeper_authorize! :write, :'write:notifications' }, except: :index

before_action :require_user!
before_action :set_request, except: :index
before_action :set_request, only: [:show, :accept, :dismiss]
before_action :set_requests, only: [:accept_bulk, :dismiss_bulk]

after_action :insert_pagination_headers, only: :index

Expand All @@ -32,6 +33,16 @@ def dismiss
render_empty
end

def accept_bulk
@requests.each { |request| AcceptNotificationRequestService.new.call(request) }
render_empty
end

def dismiss_bulk
@requests.each(&:destroy!)
render_empty
end

private

def load_requests
Expand All @@ -53,6 +64,10 @@ def set_request
@request = NotificationRequest.where(account: current_account).find(params[:id])
end

def set_requests
@requests = NotificationRequest.where(account: current_account, id: Array(params[:id]).uniq.map(&:to_i))
end

def next_path
api_v1_notifications_requests_url pagination_params(max_id: pagination_max_id) unless @requests.empty?
end
Expand Down
Loading
Loading