Compare commits

...

254 Commits

Author SHA1 Message Date
Ariadne Conill 849d7bff51 Merge pull request 'Merge in changes from upstream Mastodon/glitch-soc as of 20230511' (#59) from chore/merge-20230511-1 into main
ci/woodpecker/push/woodpecker Pipeline was successful Details
Reviewed-on: #59
2023-05-12 01:14:00 +00:00
Ariadne Conill 00412e8037 Merge gitea.treehouse.systems:mirrors/mastodon-glitch into chore/merge-20230511-1
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details
2023-05-11 17:42:39 -07:00
Claire f08f6d20e6
Merge pull request #2215 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
2023-05-09 14:47:11 +02:00
Renaud Chaput ea04f33f50 [Glitch] Fixes build errors from some previous TS-related commits
Port 45579a26cf to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 22:15:00 +02:00
fusagiko / takayamaki 3d9e35375c [Glitch] Rewrite actions/app.ts and reducers/missed_updates.ts with createAction
Port 0999cb4601 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 22:15:00 +02:00
Renaud Chaput a33d6c946a [Glitch] Remove MastodonMap TS type
Port 9a52a7f7a0 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 22:15:00 +02:00
fusagiko / takayamaki e8243d5bbd [Glitch] Add type annotation for some js files
Port e38b391940 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 22:15:00 +02:00
Claire 5f0d2b6e3b Copy Typescript type definitions to glitch-soc 2023-05-08 22:15:00 +02:00
Claire f3af434c25 [Glitch] Fix incorrect import of redux store
Port 9c1929efad to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 22:15:00 +02:00
fusagiko / takayamaki f4e3e309b1 [Glitch] use configureStore of redux-toolkit instead of createStore of redux
Port 8227af8dcc to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 22:15:00 +02:00
Eugen Rochko bbd0e9caa6 [Glitch] Add ALT badges to media that has alternative text in web UI
Port 8131a5b330 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 22:15:00 +02:00
Claire a8939e9098 [Glitch] Change media elements to use aspect-ratio rather than compute height themselves
Port 598e63dad2 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 22:15:00 +02:00
Claire 10f5329ddf [Glitch] Fix incorrect box shadow on avatar in thread view
Port d37c0a1060 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 21:09:49 +02:00
fusagiko / takayamaki 9ab89bb832 [Glitch] Add type annotation for Blurhash component
Port f50105779b to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 21:09:49 +02:00
fusagiko / takayamaki 20f1f3aa7d [Glitch] Add type annotation for IconButton component
Port 5a5975d7f7 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 21:09:49 +02:00
Claire 8b31030fe4 Fix rubocop issues in glitch-soc-specific code 2023-05-08 19:28:43 +02:00
Claire d77fbbed73 Merge commit 'f877aa9d70d0d600961989b8e97c0e0ce3ac1db6' into glitch-soc/merge-upstream
Conflicts:
- `.github/dependabot.yml`:
  Upstream made changes, but we had removed it.
  Discarded upstream changes.
- `.rubocop_todo.yml`:
  Upstream regenerated the file, we had some glitch-soc-specific ignores.
- `app/models/account_statuses_filter.rb`:
  Minor upstream code style change where glitch-soc had slightly different code
  due to handling of local-only posts.
  Updated to match upstream's code style.
- `app/models/status.rb`:
  Upstream moved ActiveRecord callback definitions, glitch-soc had an extra one.
  Moved the definitions as upstream did.
- `app/services/backup_service.rb`:
  Upstream rewrote a lot of the backup service, glitch-soc had changes because
  of exporting local-only posts.
  Took upstream changes and added back code to deal with local-only posts.
- `config/routes.rb`:
  Upstream split the file into different files, while glitch-soc had a few
  extra routes.
  Extra routes added to `config/routes/settings.rb`, `config/routes/api.rb`
  and `config/routes/admin.rb`
- `db/schema.rb`:
  Upstream has new migrations, while glitch-soc had an extra migration.
  Updated the expected serial number to match upstream's.
- `lib/mastodon/version.rb`:
  Upstream added support to set version tags from environment variables, while
  glitch-soc has an extra `+glitch` tag.
  Changed the code to support upstream's feature but prepending a `+glitch`.
- `spec/lib/activitypub/activity/create_spec.rb`:
  Minor code style change upstream, while glitch-soc has extra tests due to
  `directMessage` handling.
  Applied upstream's changes while keeping glitch-soc's extra tests.
- `spec/models/concerns/account_interactions_spec.rb`:
  Minor code style change upstream, while glitch-soc has extra tests.
  Applied upstream's changes while keeping glitch-soc's extra tests.
2023-05-08 19:28:21 +02:00
Claire f89f3a8566
Fix glitch-soc's thread line styling (#2214)
Thread lines were misaligned in glitch-soc because we have less padding and
larger avatar sizes.
2023-05-08 18:21:36 +02:00
Claire 61f3e0e95e
Merge pull request #2213 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
2023-05-08 17:59:28 +02:00
Eugen Rochko 8bf9bd5ac8 [Glitch] Fix n+1 query in settings migration
Port 0ad2413b35 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 16:15:10 +02:00
Eugen Rochko 75e28731a5 [Glitch] Fix transaction around settings migration
Port f1c1fa1411 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 16:12:05 +02:00
fusagiko / takayamaki aff2d55b80 [Glitch] Add type annotation for RelativeTimestamp component
Port 15fd712464 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 16:02:59 +02:00
fusagiko / takayamaki a49707dacb [Glitch] Rewrite Icon and IconWithBadge with typescript
Port 81f75b1e0e to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 15:59:27 +02:00
Eugen Rochko 7835f8fd22 [Glitch] Fix icons having an image role
Port 24b2c60beb to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 15:57:35 +02:00
Claire e9eab013e7 [Glitch] Fix audio player width in thread view
Port cf1bc4bb93 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 15:50:05 +02:00
Nick Schonning 51479f5c28 [Glitch] Add eslint-plugin-jsdoc
Port f22b4e556c to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 15:48:08 +02:00
Christian Schmidt 09054f5485 [Glitch] Fix media description not being cleared
Port bfeccf6748 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-08 15:41:17 +02:00
Claire 2d029dedd9 Merge commit '0ad2413b35287958f59073a5b63aecc659a64d98' into glitch-soc/merge-upstream
Conflicts:
- `app/javascript/styles/mastodon/forms.scss`:
  Conflict because we ran eslint autofix on upstream files.
- `config/initializers/content_security_policy.rb`:
  Code style changes but we have a different version.
  Kept our version.
- `streaming/index.js`:
  Upstream fixed a typo close to glitch-soc-only code.
  Applied upstream's changes.
2023-05-08 15:28:36 +02:00
Claire 5d18840ab9
Fix more JS linting issues (#2212)
* Fix uses of intl.formatMessages without default messages

* Ignore lint issue for ColumnLink button
2023-05-08 15:16:55 +02:00
Claire 16c5354b8c
Fix some more JS linting issues (#2211)
* Minor refactor and linting fixup in `flavours/glitch/actions/accounts.js`

This is some added boilerplate but it's much more consistent with the remaining
of the code, and avoids the linting issue.

* Fix missing /privacy-policy link in DM warning because of wrongly-named import

* Fix unnecessary import

* Fix regexp in flavours/glitch/utils/hashtag.js
2023-05-08 14:02:41 +02:00
Claire de74acbe0c
Fix some more Javascript linting issues and discrepancies with upstream (#2209)
* Fix typo in flavours/glitch/features/video/index.js

* Fix various linting issues and discrepancies with upstream
2023-05-07 21:43:25 +02:00
Claire ed0a407888
Fix thread lines not being properly updated when new posts are received (#2210) 2023-05-07 20:06:10 +02:00
Plastikmensch 179e38cf15
Reset language to default when cancelling a reply (#2114)
When cancelling a reply, the language was still set to the language of the replied to toot.

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>
2023-05-07 18:45:10 +02:00
Claire 3fb7fe14c6
Fix some of the Javascript linting issues, as well as bugs and unneeded divergences with upstream (#2208)
* Run eslint --fix

* Fix linting issues in video player and reduce divergences with upstream

This includes a behavior change of not auto-looping videos anymore. I don't
remember loops being ever intended, and they have been removed from upstream
a while ago, but we somehow missed the change.

* Fix lint issues in `app/javascript/flavours/glitch/selectors/index.js`

Those were basically caused by dead code that isn't present upstream, so
that brings us closer to upstream as well.

* Fix linting issue and bug in streaming/index.js

* Fix linting issues in config/webpack/shared.js

* Fix unused import in flavours/glitch/features/ui/index.js

* Fix linting issues and reduce divergences from upstream in flavours/glitch/features/ui/components/video_modal.jsx

* Fix linting issues in flavours/glitch/reducers

* Fix linting issues in glitch-soc onboarding modal

* Fix linting issues in flavours/glitch/features/ui/components/navigation_panel.jsx

* Remove dead code for unused local setting navbar_under

* Fix various linting issues

* Fix linting issues in flavours/glitch/components/scrollable_list.jsx and reduce divergences with upstream
2023-05-07 18:22:25 +02:00
Claire 9b59748679
Fix rubocop warnings (#2206) 2023-05-07 15:06:15 +02:00
Claire 6f64c79ca4
Fix SCSS linting issues (#2207)
* Disable font-family-no-missing-generic-family-keyword for font-awesome accessibility icons

* Run stylelint --fix

* Avoid `@extend` directives with doodle modal CSS

* Drop use of `@extend` for notification cleanup buttons SCSS

* Run prettier on SCSS
2023-05-07 15:04:59 +02:00
Claire a6207d243b
New Crowdin updates (#2202)
* New translations en.json (Russian)
[ci skip]

* New translations en.json (Russian)
[ci skip]
2023-05-07 13:37:47 +02:00
Matt Jankowski f877aa9d70
Use released version 4.1.0 of devise-two-factor (#24875) 2023-05-05 19:48:23 +02:00
Claire 746979f75d
Fix compose textarea scroll behavior (#24872) 2023-05-05 18:58:58 +02:00
Tim Campbell f258478395
Fixed mastodon version injection into containers via github actions (#24873) 2023-05-05 18:58:35 +02:00
mogaminsk c9e040fb24
Fix import data field type (#24874) 2023-05-05 18:10:10 +02:00
S.H 5811ccc611
Fix column back button error (#24867) 2023-05-05 15:13:28 +02:00
zunda c0ea33e3fc
Make it possible to upload audio and video to Heroku app (#24866) 2023-05-05 14:41:07 +02:00
Nick Schonning e675c10d19
Add production asset compile (#24839) 2023-05-05 09:06:51 +02:00
Tim Campbell ac41a9712e
Fixed mastodon version injection into containers via github actions (#24858) 2023-05-04 21:33:32 +02:00
Daniel M Brasil c9210af3ee
Add test coverage for `Mastodon::SettingsCLI` (#24856) 2023-05-04 20:37:42 +02:00
dependabot[bot] 64fae0efb5
Bump @babel/core from 7.21.5 to 7.21.8 (#24831)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-04 14:14:02 +02:00
Matt Jankowski 0b249ebdb0
Extract StatusSafeReblogInsert concern from Status (#24821) 2023-05-04 14:06:20 +02:00
Renaud Chaput 830e6cefae
Add version suffixes to nightly & edge image builds (#24823) 2023-05-04 13:45:39 +02:00
Nick Schonning 569b39256b
Bump rubocop-rails 2.19.1 with update .rubocop_todo.yml (#24469) 2023-05-04 11:56:24 +02:00
dependabot[bot] 880e661d53
Bump stylelint from 15.6.0 to 15.6.1 (#24829)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-04 11:30:58 +02:00
dependabot[bot] ff974395c2
Bump react-select from 5.7.2 to 5.7.3 (#24830)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-04 11:16:39 +02:00
dependabot[bot] 849d93e50a
Bump json-ld from 3.2.4 to 3.2.5 (#24832)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-04 11:06:23 +02:00
Claire c3c7d59072
Fix infinite loop in AccountsStatusesCleanupScheduler (#24840) 2023-05-04 10:13:00 +02:00
Nick Schonning f95125bd04
Fail ESLint for Warnings in CI (#24836) 2023-05-04 09:48:50 +02:00
Florin 27bafabb64
Fix Back button going outside the app (#24835) 2023-05-04 08:14:04 +02:00
Nick Schonning e1ebcc007d
Regenerate rubocop-todo (#24834) 2023-05-04 07:43:54 +02:00
Nick Schonning ff3b7069cf
Autofix Rubocop Style/ConcatArrayLiterals (#23755) 2023-05-04 05:57:40 +02:00
Nick Schonning da3bd913ae
Autofix Rubocop Style/HashSyntax (#23754) 2023-05-04 05:54:26 +02:00
Nick Schonning d5a185d721
Autofix Rubocop Style/CaseLikeIf (#23756) 2023-05-04 05:51:18 +02:00
Nick Schonning 1fe04f740a
Enable Rubocop Rails/FilePath (#23854) 2023-05-04 05:50:40 +02:00
Matt Jankowski c97b611b6b
Fix RSpec/InferredSpecType cop (#24736) 2023-05-04 05:49:53 +02:00
Matt Jankowski 710745e16b
Fix RSpec/ContextWording cop (#24739) 2023-05-04 05:49:08 +02:00
Matt Jankowski cf18cc2891
Fix RSpec/MultipleSubjects cop (#24738) 2023-05-04 05:48:35 +02:00
Matt Jankowski bdcd8a9e88
Misc spec cleanup (#24822) 2023-05-04 05:47:52 +02:00
Matt Jankowski 08fb9d300a
Spec coverage for settings/preferences/* controllers (#24825) 2023-05-04 05:44:27 +02:00
Matt Jankowski 2c6c398c60
Fix Performance/CollectionLiteralInLoop cop (#24819) 2023-05-04 05:33:55 +02:00
Matt Jankowski a1cca1c8b6
Update capistrano config lock version to match bundle (#24820) 2023-05-04 05:31:04 +02:00
Matt Jankowski d9a958fcf7
Fix Performance/RedundantMerge cop (#24817) 2023-05-04 05:25:43 +02:00
Nick Schonning b25860c509
Revert "Bump better_errors from 2.9.1 to 2.10.0 (#24779)" (#24827) 2023-05-04 05:22:50 +02:00
Claire a2a22bad23
Fix various edge cases with local moves (#24812) 2023-05-03 19:19:25 +02:00
Claire 1e75eb690d
Fix own posts not getting delivered to own lists (#24810) 2023-05-03 19:17:40 +02:00
Renaud Chaput 45579a26cf
Fixes build errors from some previous TS-related commits (#24811) 2023-05-03 16:28:14 +02:00
fusagiko / takayamaki 0999cb4601
Rewrite actions/app.ts and reducers/missed_updates.ts with createAction (#24801) 2023-05-03 15:28:39 +02:00
Claire c98b012583
Change Move handler to also move list memberships (#24808) 2023-05-03 14:03:38 +02:00
Renaud Chaput 9a52a7f7a0
Remove MastodonMap TS type (#24807) 2023-05-03 13:32:11 +02:00
fusagiko / takayamaki e38b391940
Add type annotation for some js files (#24787) 2023-05-03 11:43:29 +02:00
dependabot[bot] 9b8cb947a7
Bump better_errors from 2.9.1 to 2.10.0 (#24779)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-03 11:13:49 +02:00
Matt Jankowski 3df665fd23
Fix Lint/ConstantDefinitionInBlock cop (#24763) 2023-05-03 10:32:30 +02:00
Claire 8b636a29c6
Improve automatic post cleanup worker performances (#24785) 2023-05-03 10:31:40 +02:00
Matt Jankowski a0c9f2447e
Fix Performance/MethodObjectAsBlock cop (#24798) 2023-05-03 10:30:54 +02:00
Matt Jankowski 97385f27bd
Fix Performance/RedundantEqualityComparisonBlock cop (#24799) 2023-05-03 10:30:10 +02:00
Claire 9c1929efad
Fix incorrect import of redux store (#24805) 2023-05-03 10:29:45 +02:00
Claire d37c0a1060
Fix incorrect box shadow on avatar in thread view (#24800) 2023-05-03 09:11:20 +02:00
Matt Jankowski 668a19a2f3
Fix Performance/DeletePrefix cop (#24796) 2023-05-02 21:07:45 +02:00
Matt Jankowski 05e3abe9d9
Fix Lint/EmptyClass cop (#24795) 2023-05-02 21:06:51 +02:00
dependabot[bot] 8d61d2b0da
Bump axios from 1.3.6 to 1.4.0 (#24775)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 21:04:37 +02:00
dependabot[bot] 8f7c172eb8
Bump @babel/preset-typescript from 7.21.4 to 7.21.5 (#24776)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 21:03:26 +02:00
dependabot[bot] b0ebaeb691
Bump @babel/preset-env from 7.21.4 to 7.21.5 (#24773)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 20:50:41 +02:00
dependabot[bot] 1d49718a84
Bump @babel/runtime from 7.21.0 to 7.21.5 (#24771)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 20:46:45 +02:00
dependabot[bot] 14a7e414fc
Bump @babel/core from 7.21.4 to 7.21.5 (#24778)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 20:43:11 +02:00
fusagiko / takayamaki 8227af8dcc
use configureStore of redux-toolkit instead of createStore of redux (#24790) 2023-05-02 20:39:06 +02:00
dependabot[bot] 2839fbc733
Bump eslint-plugin-formatjs from 4.10.0 to 4.10.1 (#24770)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 20:35:13 +02:00
dependabot[bot] 4acf5f8971
Bump @typescript-eslint/eslint-plugin from 5.59.1 to 5.59.2 (#24768)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 20:24:48 +02:00
dependabot[bot] 4b87e2a8db
Bump @typescript-eslint/parser from 5.59.1 to 5.59.2 (#24774)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 20:06:13 +02:00
dependabot[bot] b75c353962
Bump yargs from 17.7.1 to 17.7.2 (#24769)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 19:40:44 +02:00
dependabot[bot] 18f58f4284
Bump jsdom from 21.1.1 to 21.1.2 (#24767)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 18:40:34 +02:00
Matt Jankowski 24491abf6d
Fix Rails/DeprecatedActiveModelErrorsMethods cop (#24742) 2023-05-02 18:39:22 +02:00
Matt Jankowski b5c4b47746
Fix Rails/ActiveRecordCallbacksOrder cop (#24689) 2023-05-02 18:23:35 +02:00
Matt Jankowski 38b2974a83
Extract AccountSearch concern from Account (#24716) 2023-05-02 18:21:36 +02:00
Matt Jankowski f1c1dd0118
Rename `with_lock` to `with_redis_lock` to avoid confusion with ActiveRecord's method (#24741) 2023-05-02 18:16:07 +02:00
Matt Jankowski a7df578f97
ApplicationHelper spec coverage, unused removal, tiny refactor (#24762) 2023-05-02 18:10:39 +02:00
dependabot[bot] c26b1b0a1c
Bump pg from 1.5.2 to 1.5.3 (#24772)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 18:08:43 +02:00
dependabot[bot] 389f0443c8
Bump cssnano from 6.0.0 to 6.0.1 (#24777)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-02 18:08:03 +02:00
Matt Jankowski 570079f8ce
Fix Performance/TimesMap cop (#24789) 2023-05-02 18:07:16 +02:00
Matt Jankowski bae694108a
Fix Performance/Count cop (#24793) 2023-05-02 18:06:43 +02:00
Claire 9189e90ff2
Add fallback redirection when getting a webfinger query `LOCAL_DOMAIN@LOCAL_DOMAIN` (#23600)
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
2023-05-02 17:42:42 +02:00
Matt Jankowski 5e060e1f44
Fix Performance/Sum cop (#24788) 2023-05-02 16:10:40 +02:00
Matt Jankowski 41eb49b984
Extract large route namespace blocks to separate files (#23914) 2023-05-02 15:41:20 +02:00
Claire a89b02af92
Check domain suspensions before trying to fetch resources (#24535) 2023-05-02 15:22:19 +02:00
Claire 1ed0ff30d3
Fix `tootctl accounts cull` crashing when encountering a domain resolving to a private address (#23378) 2023-05-02 15:10:09 +02:00
Claire b233da5996
Optimize archive export service and export zip files instead of gzipped tar files (#23360) 2023-05-02 15:09:43 +02:00
Eugen Rochko 8131a5b330
Add ALT badges to media that has alternative text in web UI (#24782) 2023-05-02 14:47:04 +02:00
Claire 6693a4fe7c
Change lists to be able to include accounts with pending follow requests (#19727) 2023-05-02 14:40:36 +02:00
Claire 598e63dad2
Change media elements to use aspect-ratio rather than compute height themselves (#24686) 2023-05-02 13:58:48 +02:00
Claire 1eb51bd749
Add request specs for caching behavior (#24592) 2023-05-02 13:58:29 +02:00
Matt Jankowski 88d33f361f
Fix Lint/DuplicateBranch cop (#24766) 2023-05-02 12:57:11 +02:00
fusagiko / takayamaki f50105779b
Add type annotation for Blurhash component (#24750) 2023-05-02 12:54:00 +02:00
fusagiko / takayamaki 5a5975d7f7
Add type annotation for IconButton component (#24753) 2023-05-02 12:53:32 +02:00
Claire 32a030dd74
Rewrite import feature (#21054) 2023-05-02 12:08:48 +02:00
Eugen Rochko 0ad2413b35
Fix n+1 query in settings migration (#24783) 2023-05-02 10:26:39 +02:00
Eugen Rochko f1c1fa1411
Fix transaction around settings migration (#24761) 2023-05-01 17:45:18 +02:00
Nick Schonning fc56eda94b
Bump stylelint-config-standard-scss from 7.0.1 to 9.0.0 (#24755)
Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh>
2023-05-01 18:23:57 +09:00
fusagiko / takayamaki 15fd712464
Add type annotation for RelativeTimestamp component (#24749) 2023-05-01 00:51:31 +02:00
fusagiko / takayamaki 81f75b1e0e
Rewrite Icon and IconWithBadge with typescript (#24747) 2023-05-01 00:51:00 +02:00
Matt Jankowski c53fe9b753
Fix RSpec/BeforeAfterAll cop (#24737) 2023-05-01 04:16:08 +09:00
Matt Jankowski d902a707a3
Fix Rails/CompactBlank cop (#24690) 2023-04-30 14:07:21 +02:00
Matt Jankowski d00e45a7d3
Fix Rails/I18nLocaleAssignment cop (#24693) 2023-04-30 14:07:03 +02:00
Matt Jankowski af824db398
Fix Rails/InverseOf cop (#24732) 2023-04-30 14:06:53 +02:00
Claire c18884de32
Merge pull request #2198 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
2023-04-30 13:06:50 +02:00
Nick Schonning 6b95aaaa65
Remove empty HTTP error translations (#24210) 2023-04-30 17:04:15 +09:00
Josh McKinney 89c01383f9
fix: remove port 80 mapping in devcontainer (#24658) 2023-04-30 17:03:28 +09:00
Eugen Rochko 0a08e9d3d3
New Crowdin updates (#24678)
Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh>
2023-04-30 17:02:11 +09:00
Mark Roszko c23d285b16
Remove the u in Favorite for non-gb english (#24667)
Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh>
2023-04-30 16:33:37 +09:00
João Pedro Marques 8f6e290c7a
Adds new follower/following routes (#24601) 2023-04-30 09:01:42 +02:00
dependabot[bot] 0669822ae8
Bump eslint from 8.38.0 to 8.39.0 (#24636)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-30 16:01:11 +09:00
dependabot[bot] 242d7864f1
Bump @types/jest from 29.4.2 to 29.5.1 (#24630)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-30 16:00:48 +09:00
dependabot[bot] 56cf092058
Bump @types/yargs from 17.0.22 to 17.0.24 (#24388)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-30 15:46:03 +09:00
dependabot[bot] fa14976a5d
Bump connection_pool from 2.3.0 to 2.4.0 (#24290)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
2023-04-30 15:45:02 +09:00
dependabot[bot] 819daeb651
Bump @types/lodash from 4.14.191 to 4.14.194 (#24576)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-30 15:39:49 +09:00
dependabot[bot] 921bef6799
Bump stylelint from 15.3.0 to 15.6.0 (#24635)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-30 15:38:53 +09:00
Daniel M Brasil e8fe941015
Fix `tootctl accounts approve --number N` not aproving N earliest registrations (#24605) 2023-04-30 06:50:58 +02:00
Matt Jankowski 2e43461100
Fix Rails/Output cop (#24687) 2023-04-30 06:48:16 +02:00
Matt Jankowski 5a2aa06a51
Fix Rails/Present cop (#24688) 2023-04-30 06:47:50 +02:00
Matt Jankowski bdc74086e6
Fix Rails/ContentTag cop (#24691) 2023-04-30 06:47:15 +02:00
Matt Jankowski 6e226f5a32
Fix Rails/ActionOrder cop (#24692) 2023-04-30 06:46:39 +02:00
Nick Schonning 470b8abb69
Run Rubocop with lint-staged on commit (#24644) 2023-04-30 06:46:16 +02:00
Matt Jankowski 60ac9e8634
Fix Rails/SquishedSQLHeredocs cop (#24694) 2023-04-30 06:43:50 +02:00
Matt Jankowski 8dcfb6e0ea
Fix Rails/HttpPositionalArguments cop (#24699) 2023-04-30 06:43:28 +02:00
Claire 678d836c7d
Fix pop-in player placeholder layout in thread view (#24715) 2023-04-30 06:42:43 +02:00
Claire cf1bc4bb93
Fix audio player width in thread view (#24713) 2023-04-30 06:42:22 +02:00
Nick Schonning f22b4e556c
Add eslint-plugin-jsdoc (#24719) 2023-04-30 02:29:54 +02:00
Christian Schmidt bfeccf6748
Fix media description not being cleared (#24720) 2023-04-30 02:29:24 +02:00
Matt Jankowski 274d561430
Enable local account key generation spec (#24728) 2023-04-30 02:28:52 +02:00
mogaminsk e0d075713f
Change i18n-fallbacks to English (#24727) 2023-04-30 02:22:20 +02:00
Matt Jankowski 4cfe52635c
Add pending spec for User.those_who_can (#24724) 2023-04-29 22:03:36 +02:00
Claire e79998a11a Restore translations from not-yet-ported onboarding changes as glitch-soc translations 2023-04-29 19:38:08 +02:00
Eugen Rochko 38eeed6cbf [Glitch] Change logo version in header based on screen size in web UI
Port 6028d047b9 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-04-29 18:54:13 +02:00
Nick Schonning 1033598416 [Glitch] Enable formatjs/prefer-pound-in-plural
Port 2daa5a1549 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-04-29 18:38:23 +02:00
Claire edec08b970 Disable full-width media in thread view 2023-04-29 12:43:01 +02:00
Claire cb97a92954 [Glitch] Fix thread lines in right-to-left locales (#24714)
Port 105f8687e4 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-04-29 12:21:44 +02:00
Claire 103b6de8b2 [Glitch] Fix sass warning about deprecated slash as division (#24653)
Port 1527b02c6d to glitch-soc

Co-authored-by: Nick Schonning <nschonni@gmail.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-04-29 12:17:06 +02:00
Eugen Rochko 7b01b7c3bf [Glitch] Add lines to threads in web UI
Port 290e4aba31 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-04-29 12:08:13 +02:00
Eugen Rochko 8015297f9e [Glitch] Change label from "For you" to "People" on explore screen in web UI
Port 7cf963eec2 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-04-29 11:34:44 +02:00
Chike Nwaenie 374a109546 [Glitch] Change styling of the recommended accounts to allow bio to be more visible
Port e1b4eeb636 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-04-29 11:28:24 +02:00
Christian Schmidt 0091b28ffe [Glitch] Use CSS to trim long card descriptions
Port e713c545b8 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-04-29 11:26:58 +02:00
Claire 11b34a903a [Glitch] Fix infinite loop in emoji replacement code
Port fbb4de3dbc to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-04-29 11:14:43 +02:00
Claire 0a813d96db [Glitch] Fix characters being emojified even when using Variation Selector 15 (text)
Port 37886c28da to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-04-29 11:12:35 +02:00
fusagiko / takayamaki 66bda4713e [Glitch] Allow `==` when null checking
Port c1a7e38d2b to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-04-29 11:09:46 +02:00
Claire 612a1ee697 Fix `body_classes` test for glitch-soc 2023-04-29 11:08:38 +02:00
Claire 12b935fadf Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `.github/dependabot.yml`:
  Updated upstream, removed in glitch-soc to disable noise.
  Kept removed.
- `CODE_OF_CONDUCT.md`:
  Upstream updated to a new version of the covenant, but I have not read it
  yet, so kept unchanged.
- `Gemfile.lock`:
  Not a real conflict, one upstream dependency updated textually too close to
  the glitch-soc only `hcaptcha` dependency.
  Applied upstream changes.
- `app/controllers/admin/base_controller.rb`:
  Minor conflict due to glitch-soc's theming system.
  Applied upstream changes.
- `app/controllers/application_controller.rb`:
  Minor conflict due to glitch-soc's theming system.
  Applied upstream changes.
- `app/controllers/disputes/base_controller.rb`:
  Minor conflict due to glitch-soc's theming system.
  Applied upstream changes.
- `app/controllers/relationships_controller.rb`:
  Minor conflict due to glitch-soc's theming system.
  Applied upstream changes.
- `app/controllers/statuses_cleanup_controller.rb`:
  Minor conflict due to glitch-soc's theming system.
  Applied upstream changes.
- `app/helpers/application_helper.rb`:
  Minor conflict due to glitch-soc's theming system.
  Applied upstream changes.
- `app/javascript/mastodon/features/compose/components/compose_form.jsx`:
  Upstream added a highlight animation for onboarding, while we changed the
  max character limit.
  Applied our local changes on top of upstream's new version.
- `app/views/layouts/application.html.haml`:
  Minor conflict due to glitch-soc's theming system.
  Applied upstream changes.
- `stylelint.config.js`:
  Upstream added ignore paths, glitch-soc had extra ignore paths.
  Added the same paths as upstream.
2023-04-29 10:44:56 +02:00
Claire 105f8687e4
Fix thread lines in right-to-left locales (#24714) 2023-04-28 13:12:35 +02:00
Claire 2a3a110f00
Fix wrong classes `audio` and `video` instead of `audio-player` and `video-player` in CSS (#24711) 2023-04-28 11:15:43 +02:00
Claire faa336e3f7
Change logged-out WebUI HTML pages to be cached for a few seconds (#24708) 2023-04-28 10:27:26 +02:00
Eugen Rochko 8979b70975
Add default post text to onboarding flow in web UI (#24705) 2023-04-28 10:05:34 +02:00
Claire 1c61869eed
Fix /api/v1/custom_emojis being cached even when unauthenticated API access is disallowed (#24665) 2023-04-28 10:01:38 +02:00
Eugen Rochko 6028d047b9
Change logo version in header based on screen size in web UI (#24707) 2023-04-28 10:00:33 +02:00
Eugen Rochko 2b0f1f365a
Remove display name input from sign-up form (#24704) 2023-04-28 08:54:43 +02:00
Eugen Rochko 7cf963eec2
Change label from "For you" to "People" on explore screen in web UI (#24706) 2023-04-28 08:54:20 +02:00
Claire a5bc4ea550
Fix refering to unused `preview-card` CSS class instead of `status-card` (#24696) 2023-04-28 07:50:31 +02:00
Matt Jankowski ece38b9318
Remove duplicate react helper method definitions (#24700) 2023-04-28 06:35:25 +02:00
Nick Schonning 8e514b1965
Unignore stuck Dependabot updates (#24670) 2023-04-27 12:12:56 +02:00
dependabot[bot] d9e9579832
Bump tesseract.js from 2.1.1 to 2.1.5 (#19084)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-27 11:26:13 +02:00
Daniel M Brasil 1d9969fadf
Fix `tootctl accounts create --reattach --force` not working with confirmed accounts (#24680) 2023-04-27 10:15:45 +02:00
Nick Schonning 49fad26eca
Drop EOL Ruby 2.7 (#24237) 2023-04-27 01:46:18 +02:00
Claire d8a06c1375
Fix preview cards layout in thread view (#24677) 2023-04-27 01:45:19 +02:00
Eugen Rochko d4511f2a76
New Crowdin updates (#24617)
Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh>
2023-04-27 04:55:06 +09:00
Plastikmensch 1565af1caf
[Glitch] [Proposal] Make able to write React in Typescript (#2190)
Port 4520e6473a to glitch-soc

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>
2023-04-26 21:30:41 +02:00
Nick Schonning 5841f1af8c
Autofix Rubocop RSpec/MatchArray (#24675) 2023-04-26 21:29:36 +02:00
Nick Schonning a3393d0d07
Autofix Rubocop RSpec/MatchArray (#24050) 2023-04-26 20:21:54 +02:00
Matt Jankowski 91a8cd21d8
React component helper specs (#24072) 2023-04-26 18:21:32 +02:00
dependabot[bot] 3029aeb838
Bump pg from 1.4.6 to 1.5.2 (#24671)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 17:46:01 +02:00
dependabot[bot] 185a71f281
Bump rack from 2.2.6.4 to 2.2.7 (#24672)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 17:45:49 +02:00
dependabot[bot] b839babb39
Bump sass from 1.62.0 to 1.62.1 (#24668)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 17:43:52 +02:00
dependabot[bot] 785b0349eb
Bump lint-staged from 13.2.1 to 13.2.2 (#24669)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 17:43:37 +02:00
dependabot[bot] 872c4e1ef2
Bump glob from 10.0.0 to 10.2.2 (#24632)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 17:36:58 +02:00
Nick Schonning 90beba57d8
Autofix Rubocop Rails/ResponseParsedBody (#24051) 2023-04-26 17:25:07 +02:00
dependabot[bot] c7cd891e86
Bump brakeman from 5.4.0 to 5.4.1 (#24006)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 17:10:21 +02:00
Nick Schonning 6403d7841e
Add Dependabot ignores for stuck updates and those needing manual interventions (#23966) 2023-04-26 17:09:26 +02:00
Matias Lago Evia 93a84f4704
Add S3 region list reference to Scalingo config (#24152) 2023-04-26 16:46:19 +02:00
dependabot[bot] 2f5608e9e5
Bump sass from 1.61.0 to 1.62.0 (#24574)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 16:30:43 +02:00
dependabot[bot] 5f624954be
Bump @typescript-eslint/eslint-plugin from 5.59.0 to 5.59.1 (#24633)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 23:10:54 +09:00
dependabot[bot] 9650a5738a
Bump @typescript-eslint/parser from 5.59.0 to 5.59.1 (#24638)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 22:35:24 +09:00
Nick Schonning dcdc614bd2
Remove postcss-scss devDep (#24223)
Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh>
2023-04-26 22:33:31 +09:00
dependabot[bot] b31ee9ab38
Bump json-schema from 3.0.0 to 4.0.0 (#24642)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 14:57:08 +02:00
dependabot[bot] 1820b55a11
Bump postcss from 8.4.22 to 8.4.23 (#24629)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 14:41:20 +02:00
dependabot[bot] 0c66358601
Bump prettier from 2.8.7 to 2.8.8 (#24631)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 14:41:09 +02:00
dependabot[bot] 855cf7802d
Bump chewy from 7.3.0 to 7.3.2 (#24637)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 14:34:46 +02:00
dependabot[bot] fba60094a2
Bump axios from 1.3.5 to 1.3.6 (#24640)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 14:34:16 +02:00
Claire b0bf6216e6
Fix /api/v1/instance/domain_blocks being unconditionally cached (#24662) 2023-04-26 11:42:47 +02:00
Claire 62ab7506d6
Fix /actor needlessly reading session cookie and varying on Signature (#24664) 2023-04-26 11:42:26 +02:00
Emelia Smith 301e03eb8c
Remove clustering from streaming API (#24655) 2023-04-26 11:37:51 +02:00
Tim Campbell 36631e40cc
Inf 123 dated nightly containers (#24656) 2023-04-25 23:11:31 +02:00
Claire 1527b02c6d
Fix sass warning about deprecated slash as division (#24653)
Co-authored-by: Nick Schonning <nschonni@gmail.com>
2023-04-25 22:15:00 +02:00
Claire 1419f90ef2
Fix some user-independent endpoints potentially reading session cookies (#24650) 2023-04-25 22:14:44 +02:00
Plastikmensch 678480d4d3
Fix small mistakes in RTL layout (#2182)
Borders in blockquotes in reply-indicator weren't colored properly.

avatar margin when viewing edited toots dropdown was applied to wrong side.

Conversations had padding applied to the wrong side.

Padding for notifcation cleaner checkboxes was applied to wrong side.

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>
2023-04-25 20:33:27 +02:00
Plastikmensch aea7866161
Change `drawer--header` to `drawer__header` (#2189)
Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>
2023-04-25 20:29:04 +02:00
Claire 276c39361b
Fix anonymous visitors getting a session cookie on first visit (#24584) 2023-04-25 16:51:38 +02:00
Eugen Rochko 6084461cd0
Change unauthenticated responses to be cached in REST API (#24348) 2023-04-25 15:41:34 +02:00
Eugen Rochko c35e3cb6ac
Add more tips to onboarding flow in web UI (#24646) 2023-04-25 11:12:37 +02:00
Eugen Rochko 8099ba04be
Change hashtags and mentions in bios to open in-app in web UI (#24643) 2023-04-25 06:33:21 +02:00
Claire e9a79d46cd
Fix crash when SSO_ACCOUNT_SETTINGS is not defined (#24628) 2023-04-24 20:26:04 +02:00
Matt Jankowski 1ac9219b31
Update `attr_encrypted` & `devise-two-factor` gems (#24626) 2023-04-24 19:08:21 +02:00
Matt Jankowski 930d84d40e
Gem version bumps (#24131) 2023-04-24 19:07:45 +02:00
Claire f45961aa98
Add feature test for OAuth access grant (#24624) 2023-04-24 19:06:58 +02:00
Eugen Rochko 804aa8d501
Fix cutting off first letter of hashtag links sometimes in web UI (#24623) 2023-04-24 09:53:54 +02:00
Nick Schonning 2daa5a1549
Enable formatjs/prefer-pound-in-plural (#24622) 2023-04-24 08:07:19 +02:00
Eugen Rochko 290e4aba31
Add lines to threads in web UI (#24549) 2023-04-24 08:07:03 +02:00
dependabot[bot] 0c81eec239
Bump @typescript-eslint/eslint-plugin from 5.58.0 to 5.59.0 (#24573)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-24 11:24:06 +09:00
dependabot[bot] 03ea084f0d
Bump @typescript-eslint/parser from 5.58.0 to 5.59.0 (#24568)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-24 10:54:07 +09:00
Nick Schonning 0bfd9f7f73
Update Contributor Covenant to 2.1 (#23980) 2023-04-23 23:11:50 +02:00
Christian Schmidt 5141697323
Remove `tai` locale (#23880) 2023-04-23 22:49:07 +02:00
Nick Schonning 2904fd0fdd
Update Stylelint disable settings and ignores (#23776) 2023-04-23 22:47:57 +02:00
Nick Schonning 0c7ce98ff6
Add eslint-plugin-formatjs (#23976) 2023-04-23 22:46:13 +02:00
Nick Schonning ef3675d688
Remove empty Kushubian (csb) local files (#24151) 2023-04-23 22:43:12 +02:00
Matt Jankowski 0a5f0a8b20
Remove instance variables from helper usage (#24203) 2023-04-23 22:35:54 +02:00
Chike Nwaenie e1b4eeb636
Change styling of the recommended accounts to allow bio to be more visible (#24480) 2023-04-23 22:33:08 +02:00
Christian Schmidt e713c545b8
Use CSS to trim long card descriptions (#24265) 2023-04-23 22:32:47 +02:00
Nick Schonning 4687967176
Autofix Rubocop Style/NumericLiterals (#24468) 2023-04-23 22:30:07 +02:00
Claire 528b8e7e3a
Fix crash in `tootctl accounts create --reattach --force` (#24557) 2023-04-23 22:29:31 +02:00
Claire 58a1b2e330
Fix caching logic with regards to Accept-Language, Cookie, and Signature (#24604) 2023-04-23 22:27:24 +02:00
Claire 5dc3173ef8
Fix AccountsStatusesCleanupScheduler not spreading deletes across accounts correctly (#24607) 2023-04-23 22:25:40 +02:00
Eugen Rochko 0461f83320
Add new onboarding flow to web UI (#24619) 2023-04-23 22:24:53 +02:00
Eugen Rochko 9d75b03ba4
New Crowdin updates (#24517)
Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh>
2023-04-22 19:37:41 +09:00
Claire 501d6197c4
Change automatic post deletion thresholds and load detection (#24614) 2023-04-21 18:14:19 +02:00
Claire fbb4de3dbc
Fix infinite loop in emoji replacement code (#24615) 2023-04-21 18:08:28 +02:00
Claire b0eba1a060
Minor clean up and optimization of the automatic post deletion code (#24613) 2023-04-21 16:53:50 +02:00
dependabot[bot] 88ce59505e
Bump rubocop from 1.49.0 to 1.50.2 (#24580)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-21 00:06:56 +09:00
Claire 37886c28da
Fix characters being emojified even when using Variation Selector 15 (text) (#20949) 2023-04-20 16:43:55 +02:00
Daniel M Brasil faf657d709
Fix uncaught ActiveRecord::StatementInvalid exception in `Mastodon::AccountsCLI#approve` (#24590) 2023-04-20 10:57:11 +02:00
Tim Campbell c62604b5f6
Added manual running to nightly image build (#24598) 2023-04-19 21:46:31 +02:00
Tim Campbell e798b8615c
Added job to build nightly container (#24595) 2023-04-19 19:20:25 +02:00
fusagiko / takayamaki c1a7e38d2b
Allow `==` when null checking (#24593) 2023-04-19 17:46:46 +02:00
Eugen Rochko e98c86050a
Refactor `Cache-Control` and `Vary` definitions (#24347) 2023-04-19 16:07:29 +02:00
1135 changed files with 28173 additions and 25444 deletions

View File

@ -26,7 +26,6 @@ services:
ports:
- '127.0.0.1:3000:3000'
- '127.0.0.1:4000:4000'
- '127.0.0.1:80:3000'
networks:
- external_network
- internal_network

View File

@ -7,6 +7,7 @@ module.exports = {
'plugin:jsx-a11y/recommended',
'plugin:import/recommended',
'plugin:promise/recommended',
'plugin:jsdoc/recommended',
],
env: {
@ -27,6 +28,7 @@ module.exports = {
'import',
'promise',
'@typescript-eslint',
'formatjs',
],
parserOptions: {
@ -71,7 +73,7 @@ module.exports = {
'comma-style': ['warn', 'last'],
'consistent-return': 'error',
'dot-notation': 'error',
eqeqeq: 'error',
eqeqeq: ['error', 'always', { 'null': 'ignore' }],
indent: ['warn', 2],
'jsx-quotes': ['error', 'prefer-single'],
'no-case-declarations': 'off',
@ -218,6 +220,33 @@ module.exports = {
'promise/no-callback-in-promise': 'off',
'promise/no-nesting': 'off',
'promise/no-promise-in-callback': 'off',
'formatjs/blocklist-elements': 'error',
'formatjs/enforce-default-message': ['error', 'literal'],
'formatjs/enforce-description': 'off', // description values not currently used
'formatjs/enforce-id': 'off', // Explicit IDs are used in the project
'formatjs/enforce-placeholders': 'off', // Issues in short_number.jsx
'formatjs/enforce-plural-rules': 'error',
'formatjs/no-camel-case': 'off', // disabledAccount is only non-conforming
'formatjs/no-complex-selectors': 'error',
'formatjs/no-emoji': 'error',
'formatjs/no-id': 'off', // IDs are used for translation keys
'formatjs/no-invalid-icu': 'error',
'formatjs/no-literal-string-in-jsx': 'off', // Should be looked at, but mainly flagging punctuation outside of strings
'formatjs/no-multiple-plurals': 'off', // Only used by hashtag.jsx
'formatjs/no-multiple-whitespaces': 'error',
'formatjs/no-offset': 'error',
'formatjs/no-useless-message': 'error',
'formatjs/prefer-formatted-message': 'error',
'formatjs/prefer-pound-in-plural': 'error',
'jsdoc/check-types': 'off',
'jsdoc/no-undefined-types': 'off',
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param-description': 'off',
'jsdoc/require-property-description': 'off',
'jsdoc/require-returns-description': 'off',
'jsdoc/require-returns': 'off',
},
overrides: [
@ -250,10 +279,13 @@ module.exports = {
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:promise/recommended',
'plugin:jsdoc/recommended',
],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'jsdoc/require-jsdoc': 'off',
},
},
{

View File

@ -43,9 +43,16 @@ jobs:
type=edge,branch=main
type=sha,prefix=,format=long
- name: Generate version suffix
id: version_vars
if: github.repository == 'mastodon/mastodon' && github.event_name == 'push' && github.ref_name == 'main'
run: |
echo mastodon_version_suffix=+edge-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v4
with:
context: .
build-args: MASTODON_VERSION_SUFFIX=${{ steps.version_vars.outputs.mastodon_version_suffix }}
platforms: linux/amd64,linux/arm64
provenance: false
builder: ${{ steps.buildx.outputs.name }}

60
.github/workflows/build-nightly.yml vendored Normal file
View File

@ -0,0 +1,60 @@
name: Build nightly container image
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
permissions:
contents: read
packages: write
jobs:
build-nightly-image:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- uses: hadolint/hadolint-action@v3.1.0
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Log in to the Github Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v4
id: meta
with:
images: |
ghcr.io/mastodon/mastodon
flavor: |
latest=auto
tags: |
type=raw,value=nightly
type=schedule,pattern=nightly-{{date 'YYYY-MM-DD' tz='Etc/UTC'}}
labels: |
org.opencontainers.image.description=Nightly build image used for testing purposes
- name: Generate version suffix
id: version_vars
run: |
echo mastodon_version_suffix=+nightly-$(date +'%Y%m%d') >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v4
with:
context: .
build-args: MASTODON_VERSION_SUFFIX=${{ steps.version_vars.outputs.mastodon_version_suffix }}
platforms: linux/amd64,linux/arm64
provenance: false
builder: ${{ steps.buildx.outputs.name }}
push: ${{ github.repository == 'mastodon/mastodon' && github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@ -48,7 +48,7 @@ jobs:
run: yarn --frozen-lockfile
- name: ESLint
run: yarn test:lint:js
run: yarn test:lint:js --max-warnings 0
- name: Typecheck
run: yarn test:typecheck

View File

@ -9,7 +9,6 @@ on:
env:
BUNDLE_CLEAN: true
BUNDLE_FROZEN: true
BUNDLE_WITHOUT: 'development production'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@ -19,8 +18,17 @@ jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
mode:
- production
- test
env:
RAILS_ENV: test
RAILS_ENV: ${{ matrix.mode }}
BUNDLE_WITH: ${{ matrix.mode }}
OTP_SECRET: precompile_placeholder
SECRET_KEY_BASE: precompile_placeholder
steps:
- uses: actions/checkout@v3
@ -50,6 +58,7 @@ jobs:
./bin/rails assets:precompile
- uses: actions/upload-artifact@v3
if: matrix.mode == 'test'
with:
path: |-
./public/assets
@ -97,14 +106,13 @@ jobs:
PAM_ENABLED: true
PAM_DEFAULT_SERVICE: pam_test
PAM_CONTROLLED_SERVICE: pam_test_controlled
BUNDLE_WITH: 'pam_authentication'
BUNDLE_WITH: 'pam_authentication test'
CI_JOBS: ${{ matrix.ci_job }}/4
strategy:
fail-fast: false
matrix:
ruby-version:
- '2.7'
- '3.0'
- '3.1'
- '.ruby-version'
@ -136,10 +144,6 @@ jobs:
ruby-version: ${{ matrix.ruby-version}}
bundler-cache: true
- name: Update system gems
if: matrix.ruby-version == '2.7'
run: gem update --system
- name: Load database schema
run: './bin/rails db:create db:schema:load db:seed'

View File

@ -1 +1 @@
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/.apt/lib/x86_64-linux-gnu:/app/.apt/usr/lib/x86_64-linux-gnu/mesa:/app/.apt/usr/lib/x86_64-linux-gnu/pulseaudio
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/.apt/lib/x86_64-linux-gnu:/app/.apt/usr/lib/x86_64-linux-gnu/mesa:/app/.apt/usr/lib/x86_64-linux-gnu/pulseaudio:/app/.apt/usr/lib/x86_64-linux-gnu/openblas-pthread

View File

@ -13,7 +13,7 @@ require:
- rubocop-capybara
AllCops:
TargetRubyVersion: 2.7 # Set to minimum supported version of CI
TargetRubyVersion: 3.0 # Set to minimum supported version of CI
DisplayCopNames: true
DisplayStyleGuide: true
ExtraDetails: true
@ -65,6 +65,7 @@ Metrics/AbcSize:
Metrics/BlockLength:
CountAsOne: ['array', 'hash', 'heredoc', 'method_call']
Exclude:
- 'config/routes.rb'
- 'lib/mastodon/*_cli.rb'
- 'lib/tasks/*.rake'
- 'app/models/concerns/account_associations.rb'
@ -85,6 +86,7 @@ Metrics/BlockLength:
- 'config/initializers/simple_form.rb'
- 'config/navigation.rb'
- 'config/routes.rb'
- 'config/routes/*.rb'
- 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb'
- 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb'
- 'lib/paperclip/gif_transcoder.rb'
@ -130,6 +132,7 @@ Metrics/ClassLength:
- 'app/services/activitypub/process_account_service.rb'
- 'app/services/activitypub/process_status_update_service.rb'
- 'app/services/backup_service.rb'
- 'app/services/bulk_import_service.rb'
- 'app/services/delete_account_service.rb'
- 'app/services/fan_out_on_write_service.rb'
- 'app/services/fetch_link_card_service.rb'
@ -158,6 +161,11 @@ Metrics/MethodLength:
Metrics/ModuleLength:
CountAsOne: [array, heredoc]
# Reason: Prevailing style is argument file paths
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsfilepath
Rails/FilePath:
EnforcedStyle: arguments
# Reason: Prevailing style uses numeric status codes, matches RSpec/Rails/HttpStatus
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railshttpstatus
Rails/HttpStatus:

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
ffmpeg
libopenblas0-pthread
libpq-dev
libxdamage1
libxfixes3

View File

@ -42,7 +42,7 @@ RUN \
bundle config set --local without 'development test' && \
bundle config set silence_root_warning true && \
bundle install -j"$(nproc)" && \
yarn install --immutable && \
yarn install && \
yarn cache clean
# Precompile assets
@ -58,12 +58,16 @@ ENV RAILS_ENV="production" \
ENV OTP_SECRET=precompile_placeholder \
SECRET_KEY_BASE=precompile_placeholder \
RAKE_NO_YARN_INSTALL_HACK=1
RUN mv ./emoji_data/all.json ./node_modules/emoji-mart/data/all.json && \
RUN mv ./emoji_data/all.json ./node_modules/emoji-mart/data/all.json && yarn install && \
bundle exec rails assets:precompile
FROM node:${NODE_VERSION}
# Use those args to specify your own version flags & suffixes
ARG MASTODON_VERSION_FLAGS=""
ARG MASTODON_VERSION_SUFFIX=""
ARG UID="991"
ARG GID="991"
@ -108,7 +112,9 @@ ENV RAILS_ENV="production" \
NODE_ENV="production" \
RAILS_SERVE_STATIC_FILES="true" \
BIND="0.0.0.0" \
SOURCE_TAG="${SOURCE_TAG}"
SOURCE_TAG="${SOURCE_TAG}" \
MASTODON_VERSION_FLAGS="${MASTODON_VERSION_FLAGS}" \
MASTODON_VERSION_SUFFIX="${MASTODON_VERSION_SUFFIX}"
# Set the run user
USER mastodon

13
Gemfile
View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
source 'https://rubygems.org'
ruby '>= 2.7.0', '< 3.3.0'
ruby '>= 3.0.0'
gem 'pkg-config', '~> 1.5'
@ -9,10 +9,10 @@ gem 'puma', '~> 6.2'
gem 'rails', '~> 6.1.7'
gem 'sprockets', '~> 3.7.2'
gem 'thor', '~> 1.2'
gem 'rack', '~> 2.2.6'
gem 'rack', '~> 2.2.7'
gem 'haml-rails', '~>2.0'
gem 'pg', '~> 1.4'
gem 'pg', '~> 1.5'
gem 'makara', '~> 0.5'
gem 'pghero'
gem 'dotenv-rails', '~> 2.8'
@ -30,7 +30,7 @@ gem 'browser'
gem 'charlock_holmes', '~> 0.7.7'
gem 'chewy', '~> 7.3'
gem 'devise', '~> 4.9'
gem 'devise-two-factor', '~> 4.0'
gem 'devise-two-factor', '~> 4.1'
group :pam_authentication, optional: true do
gem 'devise_pam_authenticatable2', '~> 9.2'
@ -76,7 +76,7 @@ gem 'redcarpet', '~> 3.6'
gem 'redis', '~> 4.5', require: ['redis', 'redis/connection/hiredis']
gem 'mario-redis-lock', '~> 1.2', require: 'redis_lock'
gem 'rqrcode', '~> 2.1'
gem 'ruby-progressbar', '~> 1.11'
gem 'ruby-progressbar', '~> 1.13'
gem 'sanitize', '~> 6.0'
gem 'scenic', '~> 1.7'
gem 'sidekiq', '~> 6.5'
@ -121,7 +121,7 @@ group :test do
gem 'capybara', '~> 3.39'
gem 'climate_control'
gem 'faker', '~> 3.2'
gem 'json-schema', '~> 3.0'
gem 'json-schema', '~> 4.0'
gem 'rack-test', '~> 2.1'
gem 'rails-controller-testing', '~> 1.0'
gem 'rspec_junit_formatter', '~> 0.6'
@ -163,3 +163,4 @@ gem 'hcaptcha', '~> 7.1'
gem 'cocoon', '~> 1.2'
gem 'net-http', '~> 0.3.2'
gem 'rubyzip', '~> 2.3'

View File

@ -104,12 +104,12 @@ GEM
activerecord (>= 3.2, < 8.0)
rake (>= 10.4, < 14.0)
ast (2.4.2)
attr_encrypted (3.1.0)
attr_encrypted (4.0.0)
encryptor (~> 3.0.0)
attr_required (1.0.1)
awrence (1.2.1)
aws-eventstream (1.2.0)
aws-partitions (1.743.0)
aws-partitions (1.752.0)
aws-sdk-core (3.171.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
@ -118,7 +118,7 @@ GEM
aws-sdk-kms (1.63.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.120.1)
aws-sdk-s3 (1.121.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
@ -142,7 +142,7 @@ GEM
blurhash (0.1.7)
bootsnap (1.16.0)
msgpack (~> 1.2)
brakeman (5.4.0)
brakeman (5.4.1)
browser (5.3.1)
brpoplpush-redis_script (0.1.3)
concurrent-ruby (~> 1.0, >= 1.0.5)
@ -156,7 +156,7 @@ GEM
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (2.0.1)
capistrano-bundler (2.1.0)
capistrano (~> 3.1)
capistrano-rails (1.6.2)
capistrano (~> 3.1)
@ -179,7 +179,7 @@ GEM
activesupport
cbor (0.5.9.6)
charlock_holmes (0.7.7)
chewy (7.3.0)
chewy (7.3.2)
activesupport (>= 5.2)
elasticsearch (>= 7.12.0, < 7.14.0)
elasticsearch-dsl
@ -189,26 +189,26 @@ GEM
coderay (1.1.3)
color_diff (0.1)
concurrent-ruby (1.2.2)
connection_pool (2.3.0)
connection_pool (2.4.0)
cose (1.3.0)
cbor (~> 0.5.9)
openssl-signature_algorithm (~> 1.0)
crack (0.4.5)
rexml
crass (1.0.6)
css_parser (1.12.0)
css_parser (1.14.0)
addressable
date (3.3.3)
debug_inspector (1.0.0)
debug_inspector (1.1.0)
devise (4.9.2)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-two-factor (4.0.2)
devise-two-factor (4.1.0)
activesupport (< 7.1)
attr_encrypted (>= 1.3, < 4, != 2)
attr_encrypted (>= 1.3, < 5, != 2)
devise (~> 4.0)
railties (< 7.1)
rotp (~> 6.0)
@ -241,7 +241,7 @@ GEM
erubi (1.12.0)
et-orbi (1.2.7)
tzinfo
excon (0.95.0)
excon (0.99.0)
fabrication (2.30.0)
faker (3.2.0)
i18n (>= 1.8.11, < 2)
@ -315,7 +315,7 @@ GEM
hashie (5.0.0)
hcaptcha (7.1.0)
json
highline (2.0.3)
highline (2.1.0)
hiredis (0.6.3)
hkdf (0.3.0)
htmlentities (4.3.4)
@ -349,15 +349,15 @@ GEM
ipaddress (0.8.3)
jmespath (1.6.2)
json (2.6.3)
json-canonicalization (0.3.1)
json-canonicalization (0.3.2)
json-jwt (1.15.3)
activesupport (>= 4.2)
aes_key_wrap
bindata
httpclient
json-ld (3.2.4)
json-ld (3.2.5)
htmlentities (~> 4.3)
json-canonicalization (~> 0.3)
json-canonicalization (~> 0.3, >= 0.3.2)
link_header (~> 0.0, >= 0.0.8)
multi_json (~> 1.15)
rack (>= 2.2, < 4)
@ -365,7 +365,7 @@ GEM
json-ld-preloaded (3.2.2)
json-ld (~> 3.2)
rdf (~> 3.2)
json-schema (3.0.0)
json-schema (4.0.0)
addressable (>= 2.8)
jsonapi-renderer (0.2.2)
jwt (2.7.0)
@ -381,8 +381,8 @@ GEM
activerecord
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
launchy (2.5.0)
addressable (~> 2.7)
launchy (2.5.2)
addressable (~> 2.8)
letter_opener (1.8.1)
launchy (>= 2.2, < 3)
letter_opener_web (2.0.0)
@ -417,11 +417,11 @@ GEM
method_source (1.0.0)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mime-types-data (3.2023.0218.1)
mini_mime (1.1.2)
mini_portile2 (2.8.1)
minitest (5.18.0)
msgpack (1.6.0)
msgpack (1.7.0)
multi_json (1.15.0)
multipart-post (2.3.0)
net-http (0.3.2)
@ -438,7 +438,7 @@ GEM
net-ssh (>= 2.6.5, < 8.0.0)
net-smtp (0.3.3)
net-protocol
net-ssh (7.0.1)
net-ssh (7.1.0)
nio4r (2.5.9)
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
@ -481,18 +481,18 @@ GEM
openssl (> 2.0)
orm_adapter (0.5.0)
ox (2.14.16)
parallel (1.22.1)
parser (3.2.2.0)
parallel (1.23.0)
parser (3.2.2.1)
ast (~> 2.4.1)
parslet (2.0.0)
pastel (0.8.0)
tty-color (~> 0.5)
pg (1.4.6)
pghero (3.3.2)
pg (1.5.3)
pghero (3.3.3)
activerecord (>= 6)
pkg-config (1.5.1)
posix-spawn (0.3.15)
premailer (1.18.0)
premailer (1.21.0)
addressable
css_parser (>= 1.12.0)
htmlentities (>= 4.0.0)
@ -502,13 +502,13 @@ GEM
premailer (~> 1.7, >= 1.7.9)
private_address_check (0.5.0)
public_suffix (5.0.1)
puma (6.2.1)
puma (6.2.2)
nio4r (~> 2.0)
pundit (2.3.0)
activesupport (>= 3.0.0)
raabro (1.4.0)
racc (1.6.2)
rack (2.2.6.4)
rack (2.2.7)
rack-attack (6.6.1)
rack (>= 1.0, < 3)
rack-cors (2.0.1)
@ -568,25 +568,25 @@ GEM
redis (>= 4)
redlock (1.3.2)
redis (>= 3.0.0, < 6.0)
regexp_parser (2.7.0)
regexp_parser (2.8.0)
request_store (1.5.1)
rack (>= 1.4)
responders (3.1.0)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.2.5)
rotp (6.2.0)
rotp (6.2.2)
rpam2 (4.0.2)
rqrcode (2.1.2)
chunky_png (~> 1.0)
rqrcode_core (~> 1.0)
rqrcode_core (1.2.0)
rspec-core (3.12.1)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.3)
rspec-mocks (3.12.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (6.0.1)
@ -604,7 +604,7 @@ GEM
rspec_chunked (0.6)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.49.0)
rubocop (1.50.2)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
@ -616,12 +616,12 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.28.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.17.1)
rubocop-capybara (2.18.0)
rubocop (~> 1.41)
rubocop-performance (1.17.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.18.0)
rubocop-rails (2.19.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
@ -633,6 +633,7 @@ GEM
nokogiri (>= 1.10.5)
rexml
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
rufus-scheduler (3.8.2)
fugit (~> 1.1, >= 1.1.6)
safety_net_attestation (0.4.0)
@ -793,7 +794,7 @@ DEPENDENCIES
concurrent-ruby
connection_pool
devise (~> 4.9)
devise-two-factor (~> 4.0)
devise-two-factor (~> 4.1)
devise_pam_authenticatable2 (~> 9.2)
discard (~> 1.2)
doorkeeper (~> 5.6)
@ -819,7 +820,7 @@ DEPENDENCIES
idn-ruby
json-ld
json-ld-preloaded (~> 3.2)
json-schema (~> 3.0)
json-schema (~> 4.0)
kaminari (~> 1.2)
kt-paperclip (~> 7.1)!
letter_opener (~> 1.8)
@ -842,7 +843,7 @@ DEPENDENCIES
omniauth_openid_connect (~> 0.6.1)
ox (~> 2.14)
parslet
pg (~> 1.4)
pg (~> 1.5)
pghero
pkg-config (~> 1.5)
posix-spawn
@ -851,7 +852,7 @@ DEPENDENCIES
public_suffix (~> 5.0)
puma (~> 6.2)
pundit (~> 2.3)
rack (~> 2.2.6)
rack (~> 2.2.7)
rack-attack (~> 6.6)
rack-cors (~> 2.0)
rack-test (~> 2.1)
@ -873,7 +874,8 @@ DEPENDENCIES
rubocop-performance
rubocop-rails
rubocop-rspec
ruby-progressbar (~> 1.11)
ruby-progressbar (~> 1.13)
rubyzip (~> 2.3)
sanitize (~> 6.0)
scenic (~> 1.7)
sidekiq (~> 6.5)

View File

@ -8,7 +8,7 @@ class AboutController < ApplicationController
before_action :set_instance_presenter
def show
expires_in 0, public: true unless user_signed_in?
expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.day) unless user_signed_in?
end
private

View File

@ -7,8 +7,9 @@ class AccountsController < ApplicationController
include AccountControllerConcern
include SignatureAuthentication
vary_by -> { public_fetch_mode? ? 'Accept, Accept-Language, Cookie' : 'Accept, Accept-Language, Cookie, Signature' }
before_action :require_account_signature!, if: -> { request.format == :json && authorized_fetch_mode? }
before_action :set_cache_headers
skip_around_action :set_locale, if: -> { [:json, :rss].include?(request.format&.to_sym) }
skip_before_action :require_functional!, unless: :whitelist_mode?
@ -16,7 +17,7 @@ class AccountsController < ApplicationController
def show
respond_to do |format|
format.html do
expires_in 0, public: true unless user_signed_in?
expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.hour) unless user_signed_in?
@rss_url = rss_url
end

View File

@ -7,10 +7,6 @@ class ActivityPub::BaseController < Api::BaseController
private
def set_cache_headers
response.headers['Vary'] = 'Signature' if authorized_fetch_mode?
end
def skip_temporary_suspension_response?
false
end

View File

@ -4,11 +4,12 @@ class ActivityPub::CollectionsController < ActivityPub::BaseController
include SignatureVerification
include AccountOwnedConcern
vary_by -> { 'Signature' if authorized_fetch_mode? }
before_action :require_account_signature!, if: :authorized_fetch_mode?
before_action :set_items
before_action :set_size
before_action :set_type
before_action :set_cache_headers
def show
expires_in 3.minutes, public: public_fetch_mode?

View File

@ -4,9 +4,10 @@ class ActivityPub::FollowersSynchronizationsController < ActivityPub::BaseContro
include SignatureVerification
include AccountOwnedConcern
vary_by -> { 'Signature' if authorized_fetch_mode? }
before_action :require_account_signature!
before_action :set_items
before_action :set_cache_headers
def show
expires_in 0, public: false

View File

@ -6,9 +6,10 @@ class ActivityPub::OutboxesController < ActivityPub::BaseController
include SignatureVerification
include AccountOwnedConcern
vary_by -> { 'Signature' if authorized_fetch_mode? || page_requested? }
before_action :require_account_signature!, if: :authorized_fetch_mode?
before_action :set_statuses
before_action :set_cache_headers
def show
if page_requested?
@ -16,6 +17,7 @@ class ActivityPub::OutboxesController < ActivityPub::BaseController
else
expires_in(3.minutes, public: public_fetch_mode?)
end
render json: outbox_presenter, serializer: ActivityPub::OutboxSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
end
@ -80,8 +82,4 @@ class ActivityPub::OutboxesController < ActivityPub::BaseController
def set_account
@account = params[:account_username].present? ? Account.find_local!(username_param) : Account.representative
end
def set_cache_headers
response.headers['Vary'] = 'Signature' if authorized_fetch_mode? || page_requested?
end
end

View File

@ -7,9 +7,10 @@ class ActivityPub::RepliesController < ActivityPub::BaseController
DESCENDANTS_LIMIT = 60
vary_by -> { 'Signature' if authorized_fetch_mode? }
before_action :require_account_signature!, if: :authorized_fetch_mode?
before_action :set_status
before_action :set_cache_headers
before_action :set_replies
def index

View File

@ -14,6 +14,10 @@ class Admin::AnnouncementsController < Admin::BaseController
@announcement = Announcement.new
end
def edit
authorize :announcement, :update?
end
def create
authorize :announcement, :create?
@ -28,10 +32,6 @@ class Admin::AnnouncementsController < Admin::BaseController
end
end
def edit
authorize :announcement, :update?
end
def update
authorize :announcement, :update?

View File

@ -9,6 +9,8 @@ module Admin
before_action :set_pack
before_action :set_body_classes
before_action :set_cache_headers
after_action :verify_authorized
private
@ -21,6 +23,10 @@ module Admin
use_pack 'admin'
end
def set_cache_headers
response.cache_control.replace(private: true, no_store: true)
end
def set_user
@user = Account.find(params[:account_id]).user || raise(ActiveRecord::RecordNotFound)
end

View File

@ -33,7 +33,7 @@ module Admin
if existing_domain_block.present? && !@domain_block.stricter_than?(existing_domain_block)
@domain_block.save
flash.now[:alert] = I18n.t('admin.domain_blocks.existing_domain_block_html', name: existing_domain_block.domain, unblock_url: admin_domain_block_path(existing_domain_block)).html_safe # rubocop:disable Rails/OutputSafety
flash.now[:alert] = I18n.t('admin.domain_blocks.existing_domain_block_html', name: existing_domain_block.domain, unblock_url: admin_domain_block_path(existing_domain_block)).html_safe
@domain_block.errors.delete(:domain)
render :new
else

View File

@ -16,6 +16,10 @@ module Admin
@role = UserRole.new
end
def edit
authorize @role, :update?
end
def create
authorize :user_role, :create?
@ -30,10 +34,6 @@ module Admin
end
end
def edit
authorize @role, :update?
end
def update
authorize @role, :update?

View File

@ -11,6 +11,10 @@ module Admin
@rule = Rule.new
end
def edit
authorize @rule, :update?
end
def create
authorize :rule, :create?
@ -24,10 +28,6 @@ module Admin
end
end
def edit
authorize @rule, :update?
end
def update
authorize @rule, :update?

View File

@ -11,6 +11,10 @@ module Admin
@warning_preset = AccountWarningPreset.new
end
def edit
authorize @warning_preset, :update?
end
def create
authorize :account_warning_preset, :create?
@ -24,10 +28,6 @@ module Admin
end
end
def edit
authorize @warning_preset, :update?
end
def update
authorize @warning_preset, :update?

View File

@ -10,12 +10,20 @@ module Admin
@webhooks = Webhook.page(params[:page])
end
def show
authorize @webhook, :show?
end
def new
authorize :webhook, :create?
@webhook = Webhook.new
end
def edit
authorize @webhook, :update?
end
def create
authorize :webhook, :create?
@ -28,14 +36,6 @@ module Admin
end
end
def show
authorize @webhook, :show?
end
def edit
authorize @webhook, :update?
end
def update
authorize @webhook, :update?

View File

@ -6,13 +6,14 @@ class Api::BaseController < ApplicationController
include RateLimitHeaders
include AccessTokenTrackingConcern
include ApiCachingConcern
skip_before_action :store_current_location
skip_before_action :require_functional!, unless: :whitelist_mode?
before_action :require_authenticated_user!, if: :disallow_unauthenticated_api_access?
before_action :require_not_suspended!
before_action :set_cache_headers
vary_by 'Authorization'
protect_from_forgery with: :null_session
@ -148,10 +149,6 @@ class Api::BaseController < ApplicationController
doorkeeper_authorize!(*scopes) if doorkeeper_token
end
def set_cache_headers
response.headers['Cache-Control'] = 'private, no-store'
end
def disallow_unauthenticated_api_access?
ENV['DISALLOW_UNAUTHENTICATED_API_ACCESS'] == 'true' || Rails.configuration.x.whitelist_mode
end

View File

@ -6,6 +6,7 @@ class Api::V1::Accounts::FollowerAccountsController < Api::BaseController
after_action :insert_pagination_headers
def index
cache_if_unauthenticated!
@accounts = load_accounts
render json: @accounts, each_serializer: REST::AccountSerializer
end

View File

@ -6,6 +6,7 @@ class Api::V1::Accounts::FollowingAccountsController < Api::BaseController
after_action :insert_pagination_headers
def index
cache_if_unauthenticated!
@accounts = load_accounts
render json: @accounts, each_serializer: REST::AccountSerializer
end

View File

@ -5,6 +5,7 @@ class Api::V1::Accounts::LookupController < Api::BaseController
before_action :set_account
def show
cache_if_unauthenticated!
render json: @account, serializer: REST::AccountSerializer
end

View File

@ -7,6 +7,7 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
after_action :insert_pagination_headers, unless: -> { truthy_param?(:pinned) }
def index
cache_if_unauthenticated!
@statuses = load_statuses
render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
end

View File

@ -18,6 +18,7 @@ class Api::V1::AccountsController < Api::BaseController
override_rate_limit_headers :follow, family: :follows
def show
cache_if_unauthenticated!
render json: @account, serializer: REST::AccountSerializer
end

View File

@ -16,6 +16,16 @@ class Api::V1::Admin::DomainAllowsController < Api::BaseController
PAGINATION_PARAMS = %i(limit).freeze
def index
authorize :domain_allow, :index?
render json: @domain_allows, each_serializer: REST::Admin::DomainAllowSerializer
end
def show
authorize @domain_allow, :show?
render json: @domain_allow, serializer: REST::Admin::DomainAllowSerializer
end
def create
authorize :domain_allow, :create?
@ -29,16 +39,6 @@ class Api::V1::Admin::DomainAllowsController < Api::BaseController
render json: @domain_allow, serializer: REST::Admin::DomainAllowSerializer
end
def index
authorize :domain_allow, :index?
render json: @domain_allows, each_serializer: REST::Admin::DomainAllowSerializer
end
def show
authorize @domain_allow, :show?
render json: @domain_allow, serializer: REST::Admin::DomainAllowSerializer
end
def destroy
authorize @domain_allow, :destroy?
UnallowDomainService.new.call(@domain_allow)

View File

@ -16,6 +16,16 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
PAGINATION_PARAMS = %i(limit).freeze
def index
authorize :domain_block, :index?
render json: @domain_blocks, each_serializer: REST::Admin::DomainBlockSerializer
end
def show
authorize @domain_block, :show?
render json: @domain_block, serializer: REST::Admin::DomainBlockSerializer
end
def create
authorize :domain_block, :create?
@ -28,16 +38,6 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
render json: @domain_block, serializer: REST::Admin::DomainBlockSerializer
end
def index
authorize :domain_block, :index?
render json: @domain_blocks, each_serializer: REST::Admin::DomainBlockSerializer
end
def show
authorize @domain_block, :show?
render json: @domain_block, serializer: REST::Admin::DomainBlockSerializer
end
def update
authorize @domain_block, :update?
@domain_block.update!(domain_block_params)

View File

@ -18,15 +18,6 @@ class Api::V1::Admin::EmailDomainBlocksController < Api::BaseController
limit
).freeze
def create
authorize :email_domain_block, :create?
@email_domain_block = EmailDomainBlock.create!(resource_params)
log_action :create, @email_domain_block
render json: @email_domain_block, serializer: REST::Admin::EmailDomainBlockSerializer
end
def index
authorize :email_domain_block, :index?
render json: @email_domain_blocks, each_serializer: REST::Admin::EmailDomainBlockSerializer
@ -37,6 +28,15 @@ class Api::V1::Admin::EmailDomainBlocksController < Api::BaseController
render json: @email_domain_block, serializer: REST::Admin::EmailDomainBlockSerializer
end
def create
authorize :email_domain_block, :create?
@email_domain_block = EmailDomainBlock.create!(resource_params)
log_action :create, @email_domain_block
render json: @email_domain_block, serializer: REST::Admin::EmailDomainBlockSerializer
end
def destroy
authorize @email_domain_block, :destroy?
@email_domain_block.destroy!

View File

@ -18,13 +18,6 @@ class Api::V1::Admin::IpBlocksController < Api::BaseController
limit
).freeze
def create
authorize :ip_block, :create?
@ip_block = IpBlock.create!(resource_params)
log_action :create, @ip_block
render json: @ip_block, serializer: REST::Admin::IpBlockSerializer
end
def index
authorize :ip_block, :index?
render json: @ip_blocks, each_serializer: REST::Admin::IpBlockSerializer
@ -35,6 +28,13 @@ class Api::V1::Admin::IpBlocksController < Api::BaseController
render json: @ip_block, serializer: REST::Admin::IpBlockSerializer
end
def create
authorize :ip_block, :create?
@ip_block = IpBlock.create!(resource_params)
log_action :create, @ip_block
render json: @ip_block, serializer: REST::Admin::IpBlockSerializer
end
def update
authorize @ip_block, :update?
@ip_block.update(resource_params)

View File

@ -1,10 +1,10 @@
# frozen_string_literal: true
class Api::V1::CustomEmojisController < Api::BaseController
skip_before_action :set_cache_headers
vary_by '', unless: :disallow_unauthenticated_api_access?
def index
expires_in 3.minutes, public: true
cache_even_if_authenticated! unless disallow_unauthenticated_api_access?
render_with_cache(each_serializer: REST::CustomEmojiSerializer) { CustomEmoji.listed.includes(:category) }
end
end

View File

@ -5,6 +5,7 @@ class Api::V1::DirectoriesController < Api::BaseController
before_action :set_accounts
def show
cache_if_unauthenticated!
render json: @accounts, each_serializer: REST::AccountSerializer
end

View File

@ -11,6 +11,10 @@ class Api::V1::FiltersController < Api::BaseController
render json: @filters, each_serializer: REST::V1::FilterSerializer
end
def show
render json: @filter, serializer: REST::V1::FilterSerializer
end
def create
ApplicationRecord.transaction do
filter_category = current_account.custom_filters.create!(filter_params)
@ -20,10 +24,6 @@ class Api::V1::FiltersController < Api::BaseController
render json: @filter, serializer: REST::V1::FilterSerializer
end
def show
render json: @filter, serializer: REST::V1::FilterSerializer
end
def update
ApplicationRecord.transaction do
@filter.update!(keyword_params)

View File

@ -3,11 +3,12 @@
class Api::V1::Instances::ActivityController < Api::BaseController
before_action :require_enabled_api!
skip_before_action :set_cache_headers
skip_before_action :require_authenticated_user!, unless: :whitelist_mode?
vary_by ''
def show
expires_in 1.day, public: true
cache_even_if_authenticated!
render_with_cache json: :activity, expires_in: 1.day
end

View File

@ -6,8 +6,15 @@ class Api::V1::Instances::DomainBlocksController < Api::BaseController
before_action :require_enabled_api!
before_action :set_domain_blocks
vary_by '', if: -> { Setting.show_domain_blocks == 'all' }
def index
expires_in 3.minutes, public: true
if Setting.show_domain_blocks == 'all'
cache_even_if_authenticated!
else
cache_if_unauthenticated!
end
render json: @domain_blocks, each_serializer: REST::DomainBlockSerializer, with_comment: (Setting.show_domain_blocks_rationale == 'all' || (Setting.show_domain_blocks_rationale == 'users' && user_signed_in?))
end

View File

@ -2,11 +2,19 @@
class Api::V1::Instances::ExtendedDescriptionsController < Api::BaseController
skip_before_action :require_authenticated_user!, unless: :whitelist_mode?
skip_around_action :set_locale
before_action :set_extended_description
vary_by ''
# Override `current_user` to avoid reading session cookies unless in whitelist mode
def current_user
super if whitelist_mode?
end
def show
expires_in 3.minutes, public: true
cache_even_if_authenticated!
render json: @extended_description, serializer: REST::ExtendedDescriptionSerializer
end

View File

@ -3,11 +3,18 @@
class Api::V1::Instances::PeersController < Api::BaseController
before_action :require_enabled_api!
skip_before_action :set_cache_headers
skip_before_action :require_authenticated_user!, unless: :whitelist_mode?
skip_around_action :set_locale
vary_by ''
# Override `current_user` to avoid reading session cookies unless in whitelist mode
def current_user
super if whitelist_mode?
end
def index
expires_in 1.day, public: true
cache_even_if_authenticated!
render_with_cache(expires_in: 1.day) { Instance.where.not(domain: DomainBlock.select(:domain)).pluck(:domain) }
end

View File

@ -5,8 +5,10 @@ class Api::V1::Instances::PrivacyPoliciesController < Api::BaseController
before_action :set_privacy_policy
vary_by ''
def show
expires_in 1.day, public: true
cache_even_if_authenticated!
render json: @privacy_policy, serializer: REST::PrivacyPolicySerializer
end

View File

@ -2,10 +2,19 @@
class Api::V1::Instances::RulesController < Api::BaseController
skip_before_action :require_authenticated_user!, unless: :whitelist_mode?
skip_around_action :set_locale
before_action :set_rules
vary_by ''
# Override `current_user` to avoid reading session cookies unless in whitelist mode
def current_user
super if whitelist_mode?
end
def index
cache_even_if_authenticated!
render json: @rules, each_serializer: REST::RuleSerializer
end

View File

@ -5,8 +5,10 @@ class Api::V1::Instances::TranslationLanguagesController < Api::BaseController
before_action :set_languages
vary_by ''
def show
expires_in 1.day, public: true
cache_even_if_authenticated!
render json: @languages
end

View File

@ -1,11 +1,18 @@
# frozen_string_literal: true
class Api::V1::InstancesController < Api::BaseController
skip_before_action :set_cache_headers
skip_before_action :require_authenticated_user!, unless: :whitelist_mode?
skip_around_action :set_locale
vary_by ''
# Override `current_user` to avoid reading session cookies unless in whitelist mode
def current_user
super if whitelist_mode?
end
def show
expires_in 3.minutes, public: true
cache_even_if_authenticated!
render_with_cache json: InstancePresenter.new, serializer: REST::V1::InstanceSerializer, root: 'instance'
end
end

View File

@ -6,19 +6,20 @@ class Api::V1::MediaController < Api::BaseController
before_action :set_media_attachment, except: [:create]
before_action :check_processing, except: [:create]
def show
render json: @media_attachment, serializer: REST::MediaAttachmentSerializer, status: status_code_for_media_attachment
end
def create
@media_attachment = current_account.media_attachments.create!(media_attachment_params)
render json: @media_attachment, serializer: REST::MediaAttachmentSerializer
rescue Paperclip::Errors::NotIdentifiedByImageMagickError
render json: file_type_error, status: 422
rescue Paperclip::Error
rescue Paperclip::Error => e
Rails.logger.error "#{e.class}: #{e.message}"
render json: processing_error, status: 500
end
def show
render json: @media_attachment, serializer: REST::MediaAttachmentSerializer, status: status_code_for_media_attachment
end
def update
@media_attachment.update!(updateable_media_attachment_params)
render json: @media_attachment, serializer: REST::MediaAttachmentSerializer, status: status_code_for_media_attachment

View File

@ -8,6 +8,7 @@ class Api::V1::PollsController < Api::BaseController
before_action :refresh_poll
def show
cache_if_unauthenticated!
render json: @poll, serializer: REST::PollSerializer, include_results: true
end

View File

@ -6,6 +6,10 @@ class Api::V1::Push::SubscriptionsController < Api::BaseController
before_action :set_push_subscription
before_action :check_push_subscription, only: [:show, :update]
def show
render json: @push_subscription, serializer: REST::WebPushSubscriptionSerializer
end
def create
@push_subscription&.destroy!
@ -21,10 +25,6 @@ class Api::V1::Push::SubscriptionsController < Api::BaseController
render json: @push_subscription, serializer: REST::WebPushSubscriptionSerializer
end
def show
render json: @push_subscription, serializer: REST::WebPushSubscriptionSerializer
end
def update
@push_subscription.update!(data: data_params)
render json: @push_subscription, serializer: REST::WebPushSubscriptionSerializer

View File

@ -8,6 +8,7 @@ class Api::V1::Statuses::FavouritedByAccountsController < Api::BaseController
after_action :insert_pagination_headers
def index
cache_if_unauthenticated!
@accounts = load_accounts
render json: @accounts, each_serializer: REST::AccountSerializer
end

View File

@ -7,6 +7,7 @@ class Api::V1::Statuses::HistoriesController < Api::BaseController
before_action :set_status
def show
cache_if_unauthenticated!
render json: @status.edits.includes(:account, status: [:account]), each_serializer: REST::StatusEditSerializer
end

View File

@ -8,6 +8,7 @@ class Api::V1::Statuses::RebloggedByAccountsController < Api::BaseController
after_action :insert_pagination_headers
def index
cache_if_unauthenticated!
@accounts = load_accounts
render json: @accounts, each_serializer: REST::AccountSerializer
end

View File

@ -24,11 +24,14 @@ class Api::V1::StatusesController < Api::BaseController
DESCENDANTS_DEPTH_LIMIT = 20
def show
cache_if_unauthenticated!
@status = cache_collection([@status], Status).first
render json: @status, serializer: REST::StatusSerializer
end
def context
cache_if_unauthenticated!
ancestors_limit = CONTEXT_LIMIT
descendants_limit = CONTEXT_LIMIT
descendants_depth_limit = nil

View File

@ -8,6 +8,7 @@ class Api::V1::TagsController < Api::BaseController
override_rate_limit_headers :follow, family: :follows
def show
cache_if_unauthenticated!
render json: @tag, serializer: REST::TagSerializer
end

View File

@ -5,6 +5,7 @@ class Api::V1::Timelines::PublicController < Api::BaseController
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
def show
cache_if_unauthenticated!
@statuses = load_statuses
render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
end

View File

@ -5,6 +5,7 @@ class Api::V1::Timelines::TagController < Api::BaseController
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
def show
cache_if_unauthenticated!
@statuses = load_statuses
render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
end

View File

@ -1,6 +1,8 @@
# frozen_string_literal: true
class Api::V1::Trends::LinksController < Api::BaseController
vary_by 'Authorization, Accept-Language'
before_action :set_links
after_action :insert_pagination_headers
@ -8,6 +10,7 @@ class Api::V1::Trends::LinksController < Api::BaseController
DEFAULT_LINKS_LIMIT = 10
def index
cache_if_unauthenticated!
render json: @links, each_serializer: REST::Trends::LinkSerializer
end

View File

@ -1,11 +1,14 @@
# frozen_string_literal: true
class Api::V1::Trends::StatusesController < Api::BaseController
vary_by 'Authorization, Accept-Language'
before_action :set_statuses
after_action :insert_pagination_headers
def index
cache_if_unauthenticated!
render json: @statuses, each_serializer: REST::StatusSerializer
end

View File

@ -8,6 +8,7 @@ class Api::V1::Trends::TagsController < Api::BaseController
DEFAULT_TAGS_LIMIT = (ENV['MAX_TRENDING_TAGS'] || 10).to_i
def index
cache_if_unauthenticated!
render json: @tags, each_serializer: REST::TagSerializer, relationships: TagRelationshipsPresenter.new(@tags, current_user&.account_id)
end

View File

@ -12,13 +12,13 @@ class Api::V2::Filters::KeywordsController < Api::BaseController
render json: @keywords, each_serializer: REST::FilterKeywordSerializer
end
def create
@keyword = current_account.custom_filters.find(params[:filter_id]).keywords.create!(resource_params)
def show
render json: @keyword, serializer: REST::FilterKeywordSerializer
end
def show
def create
@keyword = current_account.custom_filters.find(params[:filter_id]).keywords.create!(resource_params)
render json: @keyword, serializer: REST::FilterKeywordSerializer
end

View File

@ -12,13 +12,13 @@ class Api::V2::Filters::StatusesController < Api::BaseController
render json: @status_filters, each_serializer: REST::FilterStatusSerializer
end
def create
@status_filter = current_account.custom_filters.find(params[:filter_id]).statuses.create!(resource_params)
def show
render json: @status_filter, serializer: REST::FilterStatusSerializer
end
def show
def create
@status_filter = current_account.custom_filters.find(params[:filter_id]).statuses.create!(resource_params)
render json: @status_filter, serializer: REST::FilterStatusSerializer
end

View File

@ -11,13 +11,13 @@ class Api::V2::FiltersController < Api::BaseController
render json: @filters, each_serializer: REST::FilterSerializer, rules_requested: true
end
def create
@filter = current_account.custom_filters.create!(resource_params)
def show
render json: @filter, serializer: REST::FilterSerializer, rules_requested: true
end
def show
def create
@filter = current_account.custom_filters.create!(resource_params)
render json: @filter, serializer: REST::FilterSerializer, rules_requested: true
end

View File

@ -2,7 +2,7 @@
class Api::V2::InstancesController < Api::V1::InstancesController
def show
expires_in 3.minutes, public: true
cache_even_if_authenticated!
render_with_cache json: InstancePresenter.new, serializer: REST::InstanceSerializer, root: 'instance'
end
end

View File

@ -6,7 +6,8 @@ class Api::V2::MediaController < Api::V1::MediaController
render json: @media_attachment, serializer: REST::MediaAttachmentSerializer, status: @media_attachment.not_processed? ? 202 : 200
rescue Paperclip::Errors::NotIdentifiedByImageMagickError
render json: file_type_error, status: 422
rescue Paperclip::Error
rescue Paperclip::Error => e
Rails.logger.error "#{e.class}: #{e.message}"
render json: processing_error, status: 500
end
end

View File

@ -21,6 +21,8 @@ class ApplicationController < ActionController::Base
helper_method :omniauth_only?
helper_method :sso_account_settings
helper_method :whitelist_mode?
helper_method :body_class_string
helper_method :skip_csrf_meta_tags?
rescue_from ActionController::ParameterMissing, Paperclip::AdapterRegistry::NoHandlerError, with: :bad_request
rescue_from Mastodon::NotPermittedError, with: :forbidden
@ -37,9 +39,11 @@ class ApplicationController < ActionController::Base
service_unavailable
end
before_action :store_current_location, except: :raise_not_found, unless: :devise_controller?
before_action :store_referrer, except: :raise_not_found, if: :devise_controller?
before_action :require_functional!, if: :user_signed_in?
before_action :set_cache_control_defaults
skip_before_action :verify_authenticity_token, only: :raise_not_found
def raise_not_found
@ -56,14 +60,25 @@ class ApplicationController < ActionController::Base
!authorized_fetch_mode?
end
def store_current_location
store_location_for(:user, request.url) unless [:json, :rss].include?(request.format&.to_sym)
def store_referrer
return if request.referer.blank?
redirect_uri = URI(request.referer)
return if redirect_uri.path.start_with?('/auth')
stored_url = redirect_uri.to_s if redirect_uri.host == request.host && redirect_uri.port == request.port
store_location_for(:user, stored_url)
end
def require_functional!
redirect_to edit_user_registration_path unless current_user.functional?
end
def skip_csrf_meta_tags?
false
end
def after_sign_out_path_for(_resource_or_scope)
if ENV['OMNIAUTH_ONLY'] == 'true' && ENV['OIDC_ENABLED'] == 'true'
'/auth/auth/openid_connect/logout'
@ -127,7 +142,7 @@ class ApplicationController < ActionController::Base
end
def sso_account_settings
ENV.fetch('SSO_ACCOUNT_SETTINGS')
ENV.fetch('SSO_ACCOUNT_SETTINGS', nil)
end
def current_account
@ -142,6 +157,10 @@ class ApplicationController < ActionController::Base
@current_session = SessionActivation.find_by(session_id: cookies.signed['_session_id']) if cookies.signed['_session_id'].present?
end
def body_class_string
@body_classes || ''
end
def respond_with_error(code)
respond_to do |format|
format.any do
@ -151,4 +170,8 @@ class ApplicationController < ActionController::Base
format.json { render json: { error: Rack::Utils::HTTP_STATUS_CODES[code] }, status: code }
end
end
def set_cache_control_defaults
response.cache_control.replace(private: true, no_store: true)
end
end

View File

@ -25,16 +25,16 @@ class Auth::RegistrationsController < Devise::RegistrationsController
super(&:build_invite_request)
end
def destroy
not_found
end
def update
super do |resource|
resource.clear_other_sessions(current_session.session_id) if resource.saved_change_to_encrypted_password?
end
end
def destroy
not_found
end
protected
def update_resource(resource, params)
@ -157,6 +157,6 @@ class Auth::RegistrationsController < Devise::RegistrationsController
end
def set_cache_headers
response.headers['Cache-Control'] = 'private, no-store'
response.cache_control.replace(private: true, no_store: true)
end
end

View File

@ -60,7 +60,7 @@ class AuthorizeInteractionsController < ApplicationController
end
def uri_param
params[:uri] || params.fetch(:acct, '').gsub(/\Aacct:/, '')
params[:uri] || params.fetch(:acct, '').delete_prefix('acct:')
end
def set_body_classes

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
module ApiCachingConcern
extend ActiveSupport::Concern
def cache_if_unauthenticated!
expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.day) unless user_signed_in?
end
def cache_even_if_authenticated!
expires_in(5.minutes, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.day) unless whitelist_mode?
end
end

View File

@ -155,8 +155,30 @@ module CacheConcern
end
end
class_methods do
def vary_by(value, **kwargs)
before_action(**kwargs) do |controller|
response.headers['Vary'] = value.respond_to?(:call) ? controller.instance_exec(&value) : value
end
end
end
included do
after_action :enforce_cache_control!
end
# Prevents high-entropy headers such as `Cookie`, `Signature` or `Authorization`
# from being used as cache keys, while allowing to `Vary` on them (to not serve
# anonymous cached data to authenticated requests when authentication matters)
def enforce_cache_control!
vary = response.headers['Vary']&.split&.map { |x| x.strip.downcase }
return unless vary.present? && %w(cookie authorization signature).any? { |header| vary.include?(header) && request.headers[header].present? }
response.cache_control.replace(private: true, no_store: true)
end
def render_with_cache(**options)
raise ArgumentError, 'only JSON render calls are supported' unless options.key?(:json) || block_given?
raise ArgumentError, 'Only JSON render calls are supported' unless options.key?(:json) || block_given?
key = options.delete(:key) || [[params[:controller], params[:action]].join('/'), options[:json].respond_to?(:cache_key) ? options[:json].cache_key : nil, options[:fields].nil? ? nil : options[:fields].join(',')].compact.join(':')
expires_in = options.delete(:expires_in) || 3.minutes
@ -176,10 +198,6 @@ module CacheConcern
end
end
def set_cache_headers
response.headers['Vary'] = public_fetch_mode? ? 'Accept' : 'Accept, Signature'
end
def cache_collection(raw, klass)
return raw unless klass.respond_to?(:with_includes)

View File

@ -180,14 +180,15 @@ module SignatureVerification
def build_signed_string
signed_headers.map do |signed_header|
if signed_header == Request::REQUEST_TARGET
case signed_header
when Request::REQUEST_TARGET
"#{Request::REQUEST_TARGET}: #{request.method.downcase} #{request.path}"
elsif signed_header == '(created)'
when '(created)'
raise SignatureVerificationError, 'Invalid pseudo-header (created) for rsa-sha256' unless signature_algorithm == 'hs2019'
raise SignatureVerificationError, 'Pseudo-header (created) used but corresponding argument missing' if signature_params['created'].blank?
"(created): #{signature_params['created']}"
elsif signed_header == '(expires)'
when '(expires)'
raise SignatureVerificationError, 'Invalid pseudo-header (expires) for rsa-sha256' unless signature_algorithm == 'hs2019'
raise SignatureVerificationError, 'Pseudo-header (expires) used but corresponding argument missing' if signature_params['expires'].blank?
@ -244,7 +245,7 @@ module SignatureVerification
end
if key_id.start_with?('acct:')
stoplight_wrap_request { ResolveAccountService.new.call(key_id.gsub(/\Aacct:/, ''), suppress_errors: false) }
stoplight_wrap_request { ResolveAccountService.new.call(key_id.delete_prefix('acct:'), suppress_errors: false) }
elsif !ActivityPub::TagManager.instance.local_uri?(key_id)
account = ActivityPub::TagManager.instance.uri_to_actor(key_id)
account ||= stoplight_wrap_request { ActivityPub::FetchRemoteKeyService.new.call(key_id, id: false, suppress_errors: false) }

View File

@ -7,6 +7,12 @@ module WebAppControllerConcern
prepend_before_action :redirect_unauthenticated_to_permalinks!
before_action :set_pack
before_action :set_app_body_class
vary_by 'Accept, Accept-Language, Cookie'
end
def skip_csrf_meta_tags?
current_user.nil?
end
def set_app_body_class

View File

@ -1,18 +1,8 @@
# frozen_string_literal: true
class CustomCssController < ApplicationController
skip_before_action :store_current_location
skip_before_action :require_functional!
skip_before_action :update_user_sign_in
skip_before_action :set_session_activity
skip_around_action :set_locale
before_action :set_cache_headers
class CustomCssController < ActionController::Base # rubocop:disable Rails/ApplicationController
def show
expires_in 3.minutes, public: true
request.session_options[:skip] = true
render content_type: 'text/css'
end
end

View File

@ -10,6 +10,7 @@ class Disputes::BaseController < ApplicationController
before_action :set_body_classes
before_action :authenticate_user!
before_action :set_pack
before_action :set_cache_headers
private
@ -20,4 +21,8 @@ class Disputes::BaseController < ApplicationController
def set_body_classes
@body_classes = 'admin'
end
def set_cache_headers
response.cache_control.replace(private: true, no_store: true)
end
end

View File

@ -2,15 +2,12 @@
class EmojisController < ApplicationController
before_action :set_emoji
before_action :set_cache_headers
vary_by -> { 'Signature' if authorized_fetch_mode? }
def show
respond_to do |format|
format.json do
expires_in 3.minutes, public: true
render_with_cache json: @emoji, content_type: 'application/activity+json', serializer: ActivityPub::EmojiSerializer, adapter: ActivityPub::Adapter
end
end
expires_in 3.minutes, public: true
render_with_cache json: @emoji, content_type: 'application/activity+json', serializer: ActivityPub::EmojiSerializer, adapter: ActivityPub::Adapter
end
private

View File

@ -8,6 +8,7 @@ class Filters::StatusesController < ApplicationController
before_action :set_status_filters
before_action :set_pack
before_action :set_body_classes
before_action :set_cache_headers
PER_PAGE = 20
@ -49,4 +50,8 @@ class Filters::StatusesController < ApplicationController
def set_body_classes
@body_classes = 'admin'
end
def set_cache_headers
response.cache_control.replace(private: true, no_store: true)
end
end

View File

@ -7,6 +7,7 @@ class FiltersController < ApplicationController
before_action :set_filter, only: [:edit, :update, :destroy]
before_action :set_pack
before_action :set_body_classes
before_action :set_cache_headers
def index
@filters = current_account.custom_filters.includes(:keywords, :statuses).order(:phrase)
@ -17,6 +18,8 @@ class FiltersController < ApplicationController
@filter.keywords.build
end
def edit; end
def create
@filter = current_account.custom_filters.build(resource_params)
@ -27,8 +30,6 @@ class FiltersController < ApplicationController
end
end
def edit; end
def update
if @filter.update(resource_params)
redirect_to filters_path
@ -59,4 +60,8 @@ class FiltersController < ApplicationController
def set_body_classes
@body_classes = 'admin'
end
def set_cache_headers
response.cache_control.replace(private: true, no_store: true)
end
end

View File

@ -5,8 +5,9 @@ class FollowerAccountsController < ApplicationController
include SignatureVerification
include WebAppControllerConcern
vary_by -> { public_fetch_mode? ? 'Accept, Accept-Language, Cookie' : 'Accept, Accept-Language, Cookie, Signature' }
before_action :require_account_signature!, if: -> { request.format == :json && authorized_fetch_mode? }
before_action :set_cache_headers
skip_around_action :set_locale, if: -> { request.format == :json }
skip_before_action :require_functional!, unless: :whitelist_mode?
@ -14,7 +15,7 @@ class FollowerAccountsController < ApplicationController
def index
respond_to do |format|
format.html do
expires_in 0, public: true unless user_signed_in?
expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.hour) unless user_signed_in?
end
format.json do

View File

@ -5,8 +5,9 @@ class FollowingAccountsController < ApplicationController
include SignatureVerification
include WebAppControllerConcern
vary_by -> { public_fetch_mode? ? 'Accept, Accept-Language, Cookie' : 'Accept, Accept-Language, Cookie, Signature' }
before_action :require_account_signature!, if: -> { request.format == :json && authorized_fetch_mode? }
before_action :set_cache_headers
skip_around_action :set_locale, if: -> { request.format == :json }
skip_before_action :require_functional!, unless: :whitelist_mode?
@ -14,7 +15,7 @@ class FollowingAccountsController < ApplicationController
def index
respond_to do |format|
format.html do
expires_in 0, public: true unless user_signed_in?
expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.hour) unless user_signed_in?
end
format.json do

View File

@ -6,7 +6,7 @@ class HomeController < ApplicationController
before_action :set_instance_presenter
def index
expires_in 0, public: true unless user_signed_in?
expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.day) unless user_signed_in?
end
private

View File

@ -1,10 +1,13 @@
# frozen_string_literal: true
class InstanceActorsController < ApplicationController
include AccountControllerConcern
class InstanceActorsController < ActivityPub::BaseController
vary_by ''
skip_before_action :check_account_confirmation
skip_around_action :set_locale
serialization_scope nil
before_action :set_account
skip_before_action :require_functional!
skip_before_action :update_user_sign_in
def show
expires_in 10.minutes, public: true

View File

@ -9,7 +9,7 @@ class IntentsController < ApplicationController
if uri.scheme == 'web+mastodon'
case uri.host
when 'follow'
return redirect_to authorize_interaction_path(uri: uri.query_values['uri'].gsub(/\Aacct:/, ''))
return redirect_to authorize_interaction_path(uri: uri.query_values['uri'].delete_prefix('acct:'))
when 'share'
return redirect_to share_path(text: uri.query_values['text'])
end

View File

@ -8,6 +8,7 @@ class InvitesController < ApplicationController
before_action :authenticate_user!
before_action :set_pack
before_action :set_body_classes
before_action :set_cache_headers
def index
authorize :invite, :create?
@ -54,4 +55,8 @@ class InvitesController < ApplicationController
def set_body_classes
@body_classes = 'admin'
end
def set_cache_headers
response.cache_control.replace(private: true, no_store: true)
end
end

View File

@ -1,8 +1,9 @@
# frozen_string_literal: true
class ManifestsController < ApplicationController
skip_before_action :store_current_location
skip_before_action :require_functional!
class ManifestsController < ActionController::Base # rubocop:disable Rails/ApplicationController
# Prevent `active_model_serializer`'s `ActionController::Serialization` from calling `current_user`
# and thus re-issuing session cookies
serialization_scope nil
def show
expires_in 3.minutes, public: true

View File

@ -3,7 +3,6 @@
class MediaController < ApplicationController
include Authorization
skip_before_action :store_current_location
skip_before_action :require_functional!, unless: :whitelist_mode?
before_action :authenticate_user!, if: :whitelist_mode?

View File

@ -6,7 +6,6 @@ class MediaProxyController < ApplicationController
include Redisable
include Lockable
skip_before_action :store_current_location
skip_before_action :require_functional!
before_action :authenticate_user!, if: :whitelist_mode?
@ -17,7 +16,7 @@ class MediaProxyController < ApplicationController
rescue_from HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError, with: :internal_server_error
def show
with_lock("media_download:#{params[:id]}") do
with_redis_lock("media_download:#{params[:id]}") do
@media_attachment = MediaAttachment.remote.attached.find(params[:id])
authorize @media_attachment.status, :show?
redownload! if @media_attachment.needs_redownload? && !reject_media?

View File

@ -39,6 +39,6 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
end
def set_cache_headers
response.headers['Cache-Control'] = 'private, no-store'
response.cache_control.replace(private: true, no_store: true)
end
end

View File

@ -8,6 +8,7 @@ class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicatio
before_action :set_pack
before_action :require_not_suspended!, only: :destroy
before_action :set_body_classes
before_action :set_cache_headers
skip_before_action :require_functional!
@ -35,4 +36,8 @@ class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicatio
def require_not_suspended!
forbidden if current_account.suspended?
end
def set_cache_headers
response.cache_control.replace(private: true, no_store: true)
end
end

View File

@ -8,7 +8,7 @@ class PrivacyController < ApplicationController
before_action :set_instance_presenter
def show
expires_in 0, public: true if current_account.nil?
expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.day) unless user_signed_in?
end
private

View File

@ -8,6 +8,7 @@ class RelationshipsController < ApplicationController
before_action :set_pack
before_action :set_relationships, only: :show
before_action :set_body_classes
before_action :set_cache_headers
helper_method :following_relationship?, :followed_by_relationship?, :mutual_relationship?
@ -75,4 +76,8 @@ class RelationshipsController < ApplicationController
def set_pack
use_pack 'admin'
end
def set_cache_headers
response.cache_control.replace(private: true, no_store: true)
end
end

View File

@ -8,6 +8,8 @@ class Settings::ApplicationsController < Settings::BaseController
@applications = current_user.applications.order(id: :desc).page(params[:page])
end
def show; end
def new
@application = Doorkeeper::Application.new(
redirect_uri: Doorkeeper.configuration.native_redirect_uri,
@ -15,8 +17,6 @@ class Settings::ApplicationsController < Settings::BaseController
)
end
def show; end
def create
@application = current_user.applications.build(application_params)

View File

@ -19,7 +19,7 @@ class Settings::BaseController < ApplicationController
end
def set_cache_headers
response.headers['Cache-Control'] = 'private, no-store'
response.cache_control.replace(private: true, no_store: true)
end
def require_not_suspended!

View File

@ -15,7 +15,7 @@ class Settings::ExportsController < Settings::BaseController
def create
backup = nil
with_lock("backup:#{current_user.id}") do
with_redis_lock("backup:#{current_user.id}") do
authorize :backup, :create?
backup = current_user.backups.create!
end

View File

@ -1,31 +1,97 @@
# frozen_string_literal: true
class Settings::ImportsController < Settings::BaseController
before_action :set_account
require 'csv'
def show
@import = Import.new
class Settings::ImportsController < Settings::BaseController
before_action :set_bulk_import, only: [:show, :confirm, :destroy]
before_action :set_recent_imports, only: [:index]
TYPE_TO_FILENAME_MAP = {
following: 'following_accounts_failures.csv',
blocking: 'blocked_accounts_failures.csv',
muting: 'muted_accounts_failures.csv',
domain_blocking: 'blocked_domains_failures.csv',
bookmarks: 'bookmarks_failures.csv',
}.freeze
TYPE_TO_HEADERS_MAP = {
following: ['Account address', 'Show boosts', 'Notify on new posts', 'Languages'],
blocking: false,
muting: ['Account address', 'Hide notifications'],
domain_blocking: false,
bookmarks: false,
}.freeze
def index
@import = Form::Import.new(current_account: current_account)
end
def show; end
def failures
@bulk_import = current_account.bulk_imports.where(state: :finished).find(params[:id])
respond_to do |format|
format.csv do
filename = TYPE_TO_FILENAME_MAP[@bulk_import.type.to_sym]
headers = TYPE_TO_HEADERS_MAP[@bulk_import.type.to_sym]
export_data = CSV.generate(headers: headers, write_headers: true) do |csv|
@bulk_import.rows.find_each do |row|
case @bulk_import.type.to_sym
when :following
csv << [row.data['acct'], row.data.fetch('show_reblogs', true), row.data.fetch('notify', false), row.data['languages']&.join(', ')]
when :blocking
csv << [row.data['acct']]
when :muting
csv << [row.data['acct'], row.data.fetch('hide_notifications', true)]
when :domain_blocking
csv << [row.data['domain']]
when :bookmarks
csv << [row.data['uri']]
end
end
end
send_data export_data, filename: filename
end
end
end
def confirm
@bulk_import.update!(state: :scheduled)
BulkImportWorker.perform_async(@bulk_import.id)
redirect_to settings_imports_path, notice: I18n.t('imports.success')
end
def create
@import = Import.new(import_params)
@import.account = @account
@import = Form::Import.new(import_params.merge(current_account: current_account))
if @import.save
ImportWorker.perform_async(@import.id)
redirect_to settings_import_path, notice: I18n.t('imports.success')
redirect_to settings_import_path(@import.bulk_import.id)
else
render :show
# We need to set recent imports as we are displaying the index again
set_recent_imports
render :index
end
end
def destroy
@bulk_import.destroy!
redirect_to settings_imports_path
end
private
def set_account
@account = current_user.account
def import_params
params.require(:form_import).permit(:data, :type, :mode)
end
def import_params
params.require(:import).permit(:data, :type, :mode)
def set_bulk_import
@bulk_import = current_account.bulk_imports.where(state: :unconfirmed).find(params[:id])
end
def set_recent_imports
@recent_imports = current_account.bulk_imports.reorder(id: :desc).limit(10)
end
end

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class Settings::Preferences::AppearanceController < Settings::PreferencesController
class Settings::Preferences::AppearanceController < Settings::Preferences::BaseController
private
def after_update_redirect_path

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class Settings::PreferencesController < Settings::BaseController
class Settings::Preferences::BaseController < Settings::BaseController
def show; end
def update
@ -15,7 +15,7 @@ class Settings::PreferencesController < Settings::BaseController
private
def after_update_redirect_path
settings_preferences_path
raise 'Override in controller'
end
def user_params

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class Settings::Preferences::NotificationsController < Settings::PreferencesController
class Settings::Preferences::NotificationsController < Settings::Preferences::BaseController
private
def after_update_redirect_path

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class Settings::Preferences::OtherController < Settings::PreferencesController
class Settings::Preferences::OtherController < Settings::Preferences::BaseController
private
def after_update_redirect_path

View File

@ -8,9 +8,8 @@ module Settings
before_action :require_otp_enabled
before_action :require_webauthn_enabled, only: [:index, :destroy]
def new; end
def index; end
def new; end
def options
current_user.update(webauthn_id: WebAuthn.generate_user_id) unless current_user.webauthn_id

Some files were not shown because too many files have changed in this diff Show More