Compare commits

...

312 commits

Author SHA1 Message Date
Izalia Mae b9bce199fe Merge branch 'main' of https://git.barkshark.xyz/mirror/mastodon 2024-03-21 22:26:46 -04:00
Claire 3341db939c
Merge pull request #2686 from ClearlyClaire/glitch-soc/cherry-pick
Fix error when attempting to delete posts that triggered a notification request (#29666)
2024-03-20 20:13:24 +01:00
Claire 821fc53583 Fix error when attempting to delete posts that triggered a notification request (#29666) 2024-03-20 19:53:20 +01:00
Claire 58a606e0ab
Merge pull request #2685 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 8a1423a474
2024-03-20 19:43:22 +01:00
Claire 49089817b0 [Glitch] Fix “Explore” icon in navigation bar not being filled when selected
Port 3211e960ac to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-20 18:33:00 +01:00
Claire c0aade79b0 Merge commit '8a1423a47425dd67615e94bdfd13d64b53676da4' into glitch-soc/merge-upstream 2024-03-20 18:31:09 +01:00
Claire 8cac5d8f78
Merge pull request #2684 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 50fd94f481
2024-03-20 18:03:06 +01:00
Claire 8a1423a474
Allow unblocking email addresses from any matching account (#29305) 2024-03-20 14:38:00 +00:00
Matt Jankowski 0a33be39c1
Reduce LineLength for react_admin_component helpers (#29650) 2024-03-20 13:45:34 +00:00
Claire 3211e960ac
Fix “Explore” icon in navigation bar not being filled when selected (#29649) 2024-03-20 13:31:31 +00:00
Claire df777776f1 [Glitch] Fix blockquote color in reply indicator
Port 50fd94f481 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-20 12:32:37 +01:00
Claire 5e039b96c3 [Glitch] Fix emoji picker placement on limited-height viewports
Port 94f7ae192b to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-20 12:31:45 +01:00
Claire 72baa1e5c3 [Glitch] Fix emoji picker dropdown background and borders
Port e36e7ea243 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-20 12:31:12 +01:00
Claire 100cb46608 [Glitch] Fix icon and styling in browser notifications banner
Port a583317df6 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-20 12:30:45 +01:00
Claire eb3aed9545 Merge commit '50fd94f481cf23a81662140afe99df2fbf1149be' into glitch-soc/merge-upstream
Conflicts:
- `yarn.lock`:
  Upstream touched a dependency that is on an adjacent line to a
  glitch-soc-only dependency in that file.
  Updated as upstream did.
2024-03-20 12:27:52 +01:00
Claire d6f5702d66
Merge pull request #2683 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to ffc5be4820
2024-03-20 12:20:34 +01:00
Claire 50fd94f481
Fix blockquote color in reply indicator (#29659) 2024-03-20 11:20:23 +00:00
Claire a68dd889fe
Add back support for old browsers (#29654) 2024-03-20 11:07:10 +00:00
Claire 94f7ae192b
Fix emoji picker placement on limited-height viewports (#29651) 2024-03-20 11:07:02 +00:00
Claire e36e7ea243
Fix emoji picker dropdown background and borders (#29653) 2024-03-20 11:06:50 +00:00
Claire a583317df6
Fix icon and styling in browser notifications banner (#29658) 2024-03-20 11:06:44 +00:00
github-actions[bot] 6c0b1a41a1
New Crowdin Translations (automated) (#29657)
Co-authored-by: GitHub Actions <noreply@github.com>
2024-03-20 08:39:42 +00:00
renovate[bot] 5f1380415f
Update dependency postcss to v8.4.37 (#29656)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-20 08:19:08 +00:00
Claire d0dfcc9f3a Fix build issue with glitch-soc's theming system 2024-03-19 19:58:04 +01:00
Claire da2bb672ce [Glitch] Change filtered icon from “archive” to “inventory 2”
Port ffc5be4820 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-19 19:35:17 +01:00
Claire 8b3bd12def [Glitch] Slightly increase font weight of favorite/boost numbers in detailed statuses
Port bd06963c16 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-19 19:35:17 +01:00
Claire 885a4c73cb [Glitch] Add badge on account card in report moderation interface when account is already suspended
Port cf08a438e7 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-19 19:35:17 +01:00
Jeong Arm ccf2f2cb75 [Glitch] Fix mute for 30 days
Port 39839baec3 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-19 19:24:51 +01:00
Claire d959501ef1 [Glitch] Fix extra separator besides favourite count on private posts
Port 726e7ad024 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-19 19:24:34 +01:00
Claire 876aa35350 Merge commit 'ffc5be4820ed7bad4656489f096230dd7965140b' into glitch-soc/merge-upstream
Conflicts:
- `package.json`:
  Upstream updated a dependency that is on an adjacent line to a
  glitch-soc-only dependency in that file.
  Updated as upstream did.
- `yarn.lock`:
  Upstream updated a dependency that is on an adjacent line to a
  glitch-soc-only dependency in that file.
  Updated as upstream did.
2024-03-19 19:21:12 +01:00
Matt Jankowski 4c84891453
Pull out full li element into admin/status_edits/status_edit partial (#29499) 2024-03-19 16:11:10 +00:00
Claire ffc5be4820
Change filtered icon from “archive” to “inventory 2” (#29652) 2024-03-19 15:39:26 +00:00
Matt Jankowski 62e266fbd6
Add BrowserDetection model concern (#29513) 2024-03-19 15:39:14 +00:00
Matt Jankowski d7ab5655ef
Replace render_symbol method with inline_svg_tag usage (#29647) 2024-03-19 14:17:18 +00:00
Claire bc6f9befde
Change “Notifications” settings page to “E-mail notifications” (#29646) 2024-03-19 13:40:16 +00:00
Claire bd06963c16
Slightly increase font weight of favorite/boost numbers in detailed statuses (#29648) 2024-03-19 13:39:30 +00:00
renovate[bot] 42cdd0c095
Update babel monorepo to v7.24.1 (#29645)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-19 13:00:39 +00:00
renovate[bot] caee5e4d6a
Update dependency core-js to v3.36.1 (#29642)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-19 09:11:38 +00:00
Matt Jankowski 6c68c3c0ce
Introduce inline_svg gem, minimal usage, prep for material design icons (#29612) 2024-03-19 09:03:15 +00:00
github-actions[bot] 4e61bce4e9
New Crowdin Translations (automated) (#29641)
Co-authored-by: GitHub Actions <noreply@github.com>
2024-03-19 08:36:52 +00:00
Matt Jankowski 72e1162eb3
Flatten olm section of context helper extension map (#29638) 2024-03-19 08:22:46 +00:00
Claire cf08a438e7
Add badge on account card in report moderation interface when account is already suspended (#29592) 2024-03-19 08:20:53 +00:00
Jeong Arm 39839baec3
Fix mute for 30 days (#29640) 2024-03-19 08:18:14 +00:00
renovate[bot] 4ce714adea
Update dependency irb to v1.12.0 (#29519)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 14:09:18 +00:00
Matt Jankowski 6d2986017e
Remove unused active_nav_class helper method (#29617) 2024-03-18 13:24:59 +00:00
Claire d5063072c3
Revert friends-of-friends follow recommendation query to using a CTE (#29619) 2024-03-18 12:57:21 +00:00
Matt Jankowski b5115850bb
Move repeated insert_pagination_headers method to api base class (#29606) 2024-03-18 10:11:53 +00:00
renovate[bot] 58ce0002cd
Update dependency typescript to v5.4.2 (#29632)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 10:00:29 +00:00
renovate[bot] 7f17162242
Update dependency cssnano to v6.1.0 (#29514)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 10:00:13 +00:00
renovate[bot] 0dd1c772a8
Update dependency cocoon-js-vanilla to v1.5.1 (#29461)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 09:59:45 +00:00
renovate[bot] 6ebb971aad
Update dependency async-mutex to ^0.5.0 (#29552)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 09:59:31 +00:00
Claire 9142805ca8
Remove deprecated @types/… packages (#29633) 2024-03-18 09:58:28 +00:00
renovate[bot] a732ef21b0
Update dependency json-schema to v4.2.0 (#29604)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 09:37:33 +00:00
renovate[bot] 1164c7005e
Update dependency http-link-header to v1.1.3 (#29625)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 09:33:54 +00:00
Matt Jankowski f279ff3bd6
Update rspec-* gems (#29616) 2024-03-18 09:19:38 +00:00
renovate[bot] 307efe41c6
Update dependency axios to v1.6.8 (#29613)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 09:15:03 +00:00
Matt Jankowski 92855948a0
Remove unused show_landing_strip? helper method (#29618) 2024-03-18 08:55:54 +00:00
Matt Jankowski ecdbf15ebe
Remove unused link_to_older and link_to_newer helper methods (#29620) 2024-03-18 08:54:46 +00:00
renovate[bot] 97a229d5f4
Update dependency nokogiri to v1.16.3 (#29622)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 08:53:29 +00:00
renovate[bot] a0fcac9652
Update dependency postcss to v8.4.36 (#29628)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 08:49:34 +00:00
renovate[bot] 2f653174b1
Update libretranslate/libretranslate Docker tag to v1.5.6 (#29629)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 08:49:18 +00:00
renovate[bot] cf7d412367
Update peter-evans/create-pull-request action to v6.0.2 (#29630)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 08:48:37 +00:00
renovate[bot] 5d3d525d0e
Update DefinitelyTyped types (non-major) (#29631)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-18 08:48:13 +00:00
github-actions[bot] 04817e965a
New Crowdin Translations (automated) (#29623)
Co-authored-by: GitHub Actions <noreply@github.com>
2024-03-18 08:47:48 +00:00
Claire ada2ac411a
Merge pull request #2681 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to d702a03a0c
2024-03-16 22:34:16 +01:00
Claire 82c2af0356
Fix user_mailer.welcome.hashtags_recent_count not having plural form (#29607) 2024-03-16 16:38:20 +00:00
Claire 726e7ad024
Fix extra separator besides favourite count on private posts (#29605) 2024-03-16 01:11:59 +00:00
Claire c511e52d1e [Glitch] Add “Learn more” on block modal to inform of federation caveats
Port d702a03a0c to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-15 22:58:16 +01:00
Eugen Rochko 80fda17868 [Glitch] Change mute, block and domain block confirmations in web UI
Port ec19d0a14b to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-15 22:58:01 +01:00
Claire 3beba00c4e [Glitch] Change Explore icon to compass in advanced interface
Port be7a68b095 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-15 22:50:15 +01:00
Claire b8f476256e Merge commit 'd702a03a0c35fc631a0fa456532946e6751cbbfd' into glitch-soc/merge-upstream 2024-03-15 22:48:04 +01:00
Renaud Chaput 7fe848b161 [Glitch] Convert packs/public.jsx to Typescript
Port c76ae7a5c0 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-15 22:43:36 +01:00
Claire 1b06e4e1b7 Merge commit 'c76ae7a5c0d247264afa896f081db9d1fd278711' into glitch-soc/merge-upstream
Conflicts:
- `app/javascript/packs/public.jsx`:
  In glitch-soc, this file was split across the following files:
  - `app/javascript/packs/public.jsx`
  - `app/javascript/core/embed.js`
  - `app/javascript/core/settings.js`
  Update all those files accordingly, as well as the related `theme.yml` files.
2024-03-15 22:37:55 +01:00
Claire 6ee7a64465
Reduce differences with upstream in “public” pack (#2680)
* Reduce differences with upstream

* Further reduce pack differences with upstream
2024-03-15 22:21:57 +01:00
Claire 2cdac2bc38
Merge pull request #2679 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 407287573c
2024-03-15 21:38:07 +01:00
Claire d702a03a0c
Add “Learn more” on block modal to inform of federation caveats (#29614) 2024-03-15 19:09:21 +00:00
Eugen Rochko a32f992182 [Glitch] Add domain information to profiles in web UI
Port 407287573c to glitch-soc

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-15 18:51:41 +01:00
Claire 2c622497c2 Merge commit '407287573c9c602c5490224c43639b39edf7d48a' into glitch-soc/merge-upstream 2024-03-15 18:48:39 +01:00
Eugen Rochko ec19d0a14b
Change mute, block and domain block confirmations in web UI (#29576) 2024-03-15 17:36:41 +00:00
Claire ed1af46108
Merge pull request #2677 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
2024-03-15 18:23:54 +01:00
Claire be7a68b095
Change Explore icon to compass in advanced interface (#29610) 2024-03-15 16:06:48 +00:00
Matt Jankowski 4f4132f1a1
Add diagnostic message for failure during CLI search deploy (#29462) 2024-03-15 14:26:23 +00:00
Renaud Chaput c76ae7a5c0
Convert packs/public.jsx to Typescript (#29501) 2024-03-15 13:16:45 +00:00
Eugen Rochko 407287573c
Add domain information to profiles in web UI (#29602)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
2024-03-15 13:08:38 +00:00
Claire 2d4ff8f6ed Merge commit 'f445d33fd6aa492df319f4cc4efbd255d7a84f0e' into glitch-soc/merge-upstream
Conflicts:
- `app/views/admin/custom_emojis/new.html.haml`:
  Upstream split some `simple_form` arguments across multiple lines.
  One of the arguments in glitch-soc was different.
  Split as upstream's did, keeping our different limit argument.
- `app/views/admin/settings/appearance/show.html.haml`:
  Upstream split some `simple_form` arguments across multiple lines.
  Glitch-soc had a different field because of the different theming
  system.
  Kept glitch-soc's definition of that form field.
2024-03-15 12:43:59 +01:00
renovate[bot] 52200b6bbf
Update dependency sass to v1.72.0 (#29586)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-15 11:41:55 +00:00
Claire 2e49bc97b0 Merge commit '7720c684c5bf54e73e8815defe15473777d1c201' into glitch-soc/merge-upstream 2024-03-15 12:20:32 +01:00
Matt Jankowski f445d33fd6
Fix haml-lint LineLength cops in app/views/admin (#28680) 2024-03-15 11:19:00 +00:00
Matt Jankowski 7720c684c5
Move common module inclusion in sub classes to ActivityPub::BaseController (#29560) 2024-03-15 10:40:21 +00:00
Matt Jankowski 2e91a9bd34
Add include_pagination_headers matcher to check Link header in api specs (#29596) 2024-03-15 10:17:45 +00:00
github-actions[bot] 6865fda593
New Crowdin Translations (automated) (#29603)
Co-authored-by: GitHub Actions <noreply@github.com>
2024-03-15 10:02:10 +00:00
Matt Jankowski e75b55a6d7
Extract target account on list method in bulk import row service spec (#29601) 2024-03-15 09:31:25 +00:00
Matt Jankowski 838b0bdf2d
Remove unused Account::Interactions#endorsed? method (#29463) 2024-03-15 09:00:26 +00:00
Matt Jankowski d39d625561
Use inclusive range in ActivityTracker#get (#29413) 2024-03-14 21:21:01 +00:00
Claire b834f41ec1
Merge pull request #2676 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to df6086d402
2024-03-14 21:39:48 +01:00
Eugen Rochko 000a900d3b [Glitch] Fix back button appearing in column header unexpectedly in web UI
Port 30483d618f to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-14 17:43:38 +01:00
Claire 84c7b272e1 [Glitch] Fix accounts not getting imported into redux store for some filtered notification types
Port 95a5713ff7 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-14 17:43:38 +01:00
Eugen Rochko 4b2a935c4a [Glitch] Change design of metadata underneath posts in web UI
Port 4991198b70 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-14 17:43:38 +01:00
Eugen Rochko 042d17ddf1 [Glitch] Fix wrong background color on search results in web UI
Port 1e1d97a787 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-14 17:30:46 +01:00
mogaminsk 88f477749c [Glitch] Use sender's username to column title in notification request if it's display_name is not set
Port 3156d04ec1 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-14 17:29:38 +01:00
Claire e91ede5be6 Merge commit 'df6086d4027910fb160d531b4fe7ffdec26b0cd7' into glitch-soc/merge-upstream 2024-03-14 17:27:16 +01:00
Claire 31b93a5441
Merge pull request #2674 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 24319836de
2024-03-14 17:25:25 +01:00
Matt Jankowski df6086d402
Extract file size sql calc from media storage cli (#29577) 2024-03-14 15:22:52 +00:00
Matt Jankowski 6c3e718b86
Remove setting of sensitive value (default false, not null) in Status model (#29589) 2024-03-14 13:56:59 +00:00
Matt Jankowski 974c7672e5
Extract shared behavior methods in oauth feature spec (#28360) 2024-03-14 13:42:59 +00:00
Matt Jankowski 14aa7f1e15
Use Account.activitypub generated scope (#28157) 2024-03-14 13:19:20 +00:00
Matt Jankowski 049d9171eb
Use with_options for shared option in accounts#show routing block (#28914) 2024-03-14 10:03:38 +00:00
Eugen Rochko 30483d618f
Fix back button appearing in column header unexpectedly in web UI (#29551) 2024-03-14 10:01:55 +00:00
Claire 95a5713ff7
Fix accounts not getting imported into redux store for some filtered notification types (#29588) 2024-03-14 09:34:36 +00:00
Matt Jankowski 0bc17a3d48
Use enum-generated public_visibility scope on Status (#28156) 2024-03-14 09:31:57 +00:00
Matt Jankowski 19cbadfbd6
Use enum-generated scope for IpBlock in CLI (#28144) 2024-03-14 09:31:15 +00:00
Matt Jankowski 681a89f684
Readability clean up in ImportVacuum spec (#28955) 2024-03-14 09:24:00 +00:00
Matt Jankowski 79e7590578
Clean up activitypub module route scope near instance actor (#29579) 2024-03-14 09:18:46 +00:00
Matt Jankowski 65e8349980
Clean up activitypub module route scope near collections/boxes (#29580) 2024-03-14 09:18:41 +00:00
Matt Jankowski 18ffd4d925
Add module instances route scope in api routes (#29581) 2024-03-14 09:18:36 +00:00
Matt Jankowski 01ecc80118
Add module accounts route scope in api routes (#29582) 2024-03-14 09:18:31 +00:00
Eugen Rochko 4991198b70
Change design of metadata underneath posts in web UI (#29585) 2024-03-14 09:18:24 +00:00
Matt Jankowski f9100743ec
Add Api::ErrorHandling concern for api/base controller (#29574) 2024-03-14 09:09:47 +00:00
Eugen Rochko 1e1d97a787
Fix wrong background color on search results in web UI (#29584) 2024-03-14 09:07:29 +00:00
github-actions[bot] 5aea35de13
New Crowdin Translations (automated) (#29587)
Co-authored-by: GitHub Actions <noreply@github.com>
2024-03-14 09:00:42 +00:00
Matt Jankowski 42875fee52
Add coverage for bad args/options in CLI::Domains#purge (#29578) 2024-03-14 08:58:53 +00:00
mogaminsk 3156d04ec1
Use sender's username to column title in notification request if it's display_name is not set (#29575) 2024-03-14 08:58:44 +00:00
Claire 369e728536 Fix collapsed posts background color 2024-03-13 20:17:58 +01:00
Claire e7b49181af [Glitch] Hide media by default in notification requests
Port a32a126cac to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-13 20:15:23 +01:00
Claire 65ca37bbaa Merge commit 'a32a126cac42c73236236b5a9bd660765b9c58ee' into glitch-soc/merge-upstream
Conflicts:
- `spec/lib/sanitize/config_spec.rb`:
  Conflict due to glitch-soc having factored the file differently.
  Ported upstream's changes.
2024-03-13 20:14:18 +01:00
Renaud Chaput 663dd49a85 [Glitch] Fix navigation panel icons missing classes
Port acf3f410ae to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-13 20:13:35 +01:00
Erik Uden e1b64151a2 [Glitch] Fix toggle button color for light (and dark/default) theme
Port 268856d5d9 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-13 20:13:35 +01:00
Claire 48134bcd10 Merge commit 'acf3f410aef3cfb9e8f5f73042526de9b2f96d13' into glitch-soc/merge-upstream 2024-03-13 20:13:29 +01:00
Claire 08b10cce52 Merge commit 'b43eaa4517107326c7e73b949cec759f841b4a30' into glitch-soc/merge-upstream
Conflicts:
- `spec/controllers/api/v1/accounts/credentials_controller_spec.rb`
  Conflict due to glitch-soc's different note length handling.
  Ported the changes in `spec/requests/api/v1/accounts/credentials_spec.rb` instead.
2024-03-13 20:12:58 +01:00
Matt Jankowski 00d72866a3 [Glitch] Use vanilla JS to get Rails CSRF values
Port 00d94f3ffa to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-13 19:17:59 +01:00
Claire 06881a8669 Merge commit '2c0441acd7f943a9873b650cf75d33c73d545acf' into glitch-soc/merge-upstream 2024-03-13 19:16:47 +01:00
Eugen Rochko 8c0673037a [Glitch] Change background color in web UI
Port 5b60d4b696

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-13 19:05:05 +01:00
Claire c6dbb33944 Merge commit 'd4ed7e466c41f19e5f9352700c76e7ffc4d28119' into glitch-soc/merge-upstream 2024-03-13 18:58:47 +01:00
Renaud Chaput 435c46b316 [Glitch] Fix i18n typo
Port af4e44e30a to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-13 18:58:00 +01:00
Claire 27ffc09847 Merge commit 'af4e44e30a6a2701102a7d573e47e9db42025821' into glitch-soc/merge-upstream 2024-03-13 18:56:40 +01:00
Eugen Rochko b36e96ec90 [Glitch] Change action button to be last on profiles in web UI
Port 19efa1b9f1 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-13 18:40:00 +01:00
Eugen Rochko 13c9524436 [Glitch] Add notification policies and notification requests in web UI
Port c10bbf5fe3 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-13 18:38:46 +01:00
Claire a32a126cac
Hide media by default in notification requests (#29572) 2024-03-13 16:47:48 +00:00
Matt Jankowski 71e5f0f48c
Add coverage for suspended instance actor scenario (#29571) 2024-03-13 15:43:40 +00:00
Matt Jankowski 6262ceeb70
Fix RSpec/DescribedClass cop (#29472) 2024-03-13 15:42:39 +00:00
Matt Jankowski c09b8a7164
Add Account.without_internal scope (#29559)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
2024-03-13 14:11:23 +00:00
Renaud Chaput acf3f410ae
Fix navigation panel icons missing classes (#29569) 2024-03-13 12:54:50 +00:00
github-actions[bot] 171948b910
New Crowdin Translations (automated) (#29563)
Co-authored-by: GitHub Actions <noreply@github.com>
2024-03-13 12:42:44 +00:00
Erik Uden 268856d5d9
Fix toggle button color for light (and dark/default) theme (#29553) 2024-03-13 11:45:20 +00:00
Claire b43eaa4517
Refactor notification filtering behavior definition (#29567) 2024-03-13 10:35:49 +00:00
Claire 27fd084cb5
Exempt some notification types from notification filtering (#29565) 2024-03-13 10:17:55 +00:00
Matt Jankowski 46e902f1f3
Merge api/v1/accounts/credentials controller spec into existing request spec (#29006) 2024-03-13 09:22:43 +00:00
Matt Jankowski 2c0441acd7
Use rails built-in tag methods in TextFormatter.shortened_link (#28976) 2024-03-13 09:19:54 +00:00
Matt Jankowski 7e6eb64f1e
Use full snowflake range in admin/metrics classes (#29416) 2024-03-13 08:56:37 +00:00
Matt Jankowski 9754967d5f
Move pagination_max_id and pagination_since_id into api/base controller (#28844) 2024-03-13 08:51:44 +00:00
Matt Jankowski 01b624c4a0
Use normalizes on CustomFilter#context value (#27602) 2024-03-13 08:50:21 +00:00
Matt Jankowski 71eecbfa1f
Move api/v2/filters/* to request spec (#28956) 2024-03-13 08:47:09 +00:00
Matt Jankowski 8349b45d60
Accept extra args that we wont verify in ap/activity/add_spec (#29005) 2024-03-13 08:46:11 +00:00
Matt Jankowski 469028b6d3
Remove unneeded type: :service from spec/services files (#29304) 2024-03-13 08:39:26 +00:00
Matt Jankowski 3eaac3af73
Use before_all block to setup requests/cache_spec data (#29437) 2024-03-13 08:38:57 +00:00
Matt Jankowski 19f0590795
Add basic coverage for TagSearchService class (#29319) 2024-03-13 08:33:03 +00:00
Matt Jankowski 96013cd576
Reduce RSpec/ExampleLength in CSP request spec (#29104) 2024-03-13 08:22:32 +00:00
Matt Jankowski 00d94f3ffa
Use vanilla JS to get Rails CSRF values (#29403) 2024-03-12 17:10:37 +00:00
Matt Jankowski d4ed7e466c
Extract by_domain_length scope in DomainNormalizable concern (#29517) 2024-03-12 13:09:11 +00:00
Eugen Rochko 5b60d4b696
Change background color in web UI (#29522) 2024-03-12 09:51:30 +00:00
Renaud Chaput af4e44e30a
Fix i18n typo (#29557) 2024-03-12 09:42:51 +00:00
cuithon 0ba9f58e17
chore: fix some typos (#29555)
Signed-off-by: cuithon <dscs@outlook.com>
2024-03-12 09:40:29 +00:00
github-actions[bot] dc36b961aa
New Crowdin Translations (automated) (#29554)
Co-authored-by: GitHub Actions <noreply@github.com>
2024-03-12 09:03:51 +00:00
Matt Jankowski 216cea1e27
Fix incorrect frequency value in FriendsOfFriendsSource data (#29550) 2024-03-12 08:38:32 +00:00
Eugen Rochko 3631ddbfc9 [Glitch] Change icons in navigation panel to be filled when active in web UI
Port 16c856729b

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-11 18:09:07 +01:00
Renaud Chaput 6440651976 [Glitch] Use the server setting to get the max number of poll options in UI
Port b9722dfe2b to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-11 17:38:07 +01:00
Eugen Rochko efbc8cba17 [Glitch] Change dropdown menu icon to not be replaced by close icon when open in web UI
Port 2347ea813e to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-11 17:36:07 +01:00
Eugen Rochko 777510a696 [Glitch] Add hints for rules
Port 5b3a8737d6 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-11 17:34:02 +01:00
Claire a5127d0ef8 Merge commit '24319836de6046fb2985ec1a24c30ad7d47584d7' into glitch-soc/merge-upstream
Conflicts:
- `config/routes/api.rb`:
  glitch-soc has an extra `:destroy` action on notifications for historical reasons.
  Kept it for now, while otherwise updating as upstream did.
2024-03-11 17:29:07 +01:00
Matt Jankowski 24319836de
Convert request-based setup into factory setup in push/subscriptions request spec (#29489) 2024-03-11 15:46:25 +00:00
Matt Jankowski a38e424185
Use unchanging github links in docs/comments (#29545) 2024-03-11 15:14:55 +00:00
Eugen Rochko c10bbf5fe3
Add notification policies and notification requests in web UI (#29433) 2024-03-11 15:02:21 +00:00
Eugen Rochko 19efa1b9f1
Change action button to be last on profiles in web UI (#29533) 2024-03-11 14:33:48 +00:00
Eugen Rochko 16c856729b
Change icons in navigation panel to be filled when active in web UI (#29537) 2024-03-11 13:35:23 +00:00
Jeong Arm 4a6ddbc9c0
Normalize idna domain before account unblock domain (#29530) 2024-03-11 09:28:08 +00:00
Matt Jankowski a7284690fc
Add coverage for admin/metrics base classes, simplify subclass generation (#29527) 2024-03-11 09:16:19 +00:00
Renaud Chaput b9722dfe2b
Use the server setting to get the max number of poll options in UI (#29490) 2024-03-11 09:13:35 +00:00
renovate[bot] 6984f94044
Update dependency autoprefixer to v10.4.18 (#29475)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-11 09:05:07 +00:00
Eugen Rochko 2347ea813e
Change dropdown menu icon to not be replaced by close icon when open in web UI (#29532) 2024-03-11 08:57:23 +00:00
Eugen Rochko 5b3a8737d6
Add hints for rules (#29539) 2024-03-11 08:57:07 +00:00
Matt Jankowski 98ef38e34e
Ensure unique values in fabricators (#29515) 2024-03-11 08:53:24 +00:00
renovate[bot] 6f8ec6d7f8
Update dependency test-prof to v1.3.2 (#29528)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-11 08:50:54 +00:00
renovate[bot] 7b89d6842e
Update DefinitelyTyped types (non-major) (#29543)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-11 08:49:07 +00:00
renovate[bot] df3798a6fa
Update dependency eslint-plugin-jsdoc to v48.2.1 (#29544)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-11 08:49:04 +00:00
github-actions[bot] f85168b189
New Crowdin Translations (automated) (#29467)
Co-authored-by: GitHub Actions <noreply@github.com>
2024-03-11 07:37:04 +00:00
gunchleoc 81400b02b1
Add nds locale to posting languages (#27434) 2024-03-10 10:25:13 +00:00
Claire bb3ad2b2a9
Merge pull request #2669 from ClearlyClaire/glitch-soc/reduce-upstream-differences
Reduce code differences with upstream
2024-03-08 23:10:02 +01:00
Claire 46152a19a6 Convert logo.jsx to Typescript 2024-03-08 12:46:49 +01:00
Sunny Ripert 2b4e9fbc71 [Glitch] Add form element on focal point modal
Port 8515bc7962 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-08 12:43:59 +01:00
Claire 98cf4b7ba0 Reduce code differences with upstream 2024-03-08 12:42:03 +01:00
neetshin 6996b96fab [Glitch] Make columns-area unscrollable when modal opened
Port 2091ae92be to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-08 11:50:23 +01:00
Claire a79bd2cd11 Make some CSS differences with upstream more explicit 2024-03-08 11:47:34 +01:00
Claire d09ab957d4 Remove duplicate captcha_enabled key in app/models/form/admin_settings.rb 2024-03-08 11:38:01 +01:00
Claire e95f2c2b68
Add a glitch-soc local setting to make the post publish toast optional (#2666) 2024-03-08 11:35:18 +01:00
Eugen Rochko e85a2aa18d
Fix interaction settings migration error when encountering no settings (#29529) 2024-03-08 09:10:07 +00:00
github-actions[bot] d002458c7b
New Crowdin Translations (automated) (#2661)
* New Crowdin translations

* Fix bogus translations

---------

Co-authored-by: GitHub Actions <noreply@github.com>
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
2024-03-07 22:39:48 +01:00
Claire f407505f75
Merge pull request #2667 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 653ce43abe
2024-03-07 19:04:33 +01:00
renovate[bot] e8605a69d2
Update omniauth packages (#25306)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renaud Chaput <renchap@gmail.com>
2024-03-07 18:02:24 +00:00
renovate[bot] 509528e2dc
Update dependency pg to v1.5.6 (#29477)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-07 17:33:54 +00:00
Eugen Rochko 50b17f7e10
Add notification policies and notification requests (#29366) 2024-03-07 14:53:37 +00:00
Mashiro 1fc6edfa84 [Glitch] Fix unhandled nullable attachments limitation counter
Port b8bd94ca8e to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-03-07 13:01:21 +01:00
Claire 442a5cb66c Merge commit '653ce43abe0a928d944a15c433d2c8324f9b5e2a' into glitch-soc/merge-upstream 2024-03-07 12:59:51 +01:00
Claire 3f239facff
Update flavor screenshots (#2664) 2024-03-07 12:59:00 +01:00
Renaud Chaput 653ce43abe
Update json-jwt gem to fix CVE-2023-51774 (#29520) 2024-03-07 11:11:14 +00:00
gunchleoc c01f4cebed
Add Mohawk to posting languages (#27115) 2024-03-07 11:04:31 +00:00
gunchleoc 995e15c24a
Add Jawi Malay to posting languages (#29098) 2024-03-07 11:03:41 +00:00
Claire 8c9341a67b
Further reduce pointless CSS differences with upstream (#2665) 2024-03-06 22:13:23 +01:00
Claire a11151d58f
Update our README and include upstream's (#2663) 2024-03-06 22:12:57 +01:00
Mashiro b8bd94ca8e
Fix unhandled nullable attachments limitation counter (#29183) 2024-03-06 12:53:54 +00:00
Claire 8f4cc711c2
Merge pull request #2662 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to f89512fbed
2024-03-05 20:56:08 +01:00
Claire 45e56db8e4 Merge commit 'f89512fbedb547f66a72eefdff047768fb505eb6' into glitch-soc/merge-upstream
Conflicts:
- `README.md`:
  Upstream updated its README, we have a completely different one.
  Kept our version.
2024-03-05 16:25:50 +01:00
renovate[bot] f89512fbed
Update dependency rack-cors to v2.0.2 [SECURITY] (#29507)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-05 15:09:52 +01:00
renovate[bot] 7265d47342
Update peter-evans/create-pull-request action to v6.0.1 (#29503)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-05 09:42:49 +00:00
renovate[bot] 4c138ee4eb
Update DefinitelyTyped types (non-major) (#29502)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-05 09:42:26 +00:00
renovate[bot] cb0f3ecc28
Update eslint (non-major) (#29505)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-05 09:41:31 +00:00
renovate[bot] 0f7f257139
Update Yarn to v4.1.1 (#29508)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-05 09:39:12 +00:00
Claire 74998b0636
Merge pull request #2657 from glitch-soc/i18n/crowdin/translations
New Crowdin Translations (automated)
2024-03-04 16:27:34 +01:00
Claire a7d9c5e374 Fix bogus translations 2024-03-04 11:27:37 +01:00
Claire ee8d0b9447
Fix follow suggestions potentially including silenced or blocked accounts (#29306) 2024-03-04 06:35:20 +00:00
GitHub Actions 1b418a3550 New Crowdin translations 2024-03-04 04:57:12 +00:00
Claire 96c6cafc34
Merge pull request #2660 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 18945f62e0
2024-03-03 16:11:28 +01:00
renovate[bot] 68600893d2
Update babel monorepo to v7.24.0 (#29434)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-02 18:33:33 +00:00
Matt Jankowski 64b8ba36bb
Add bin/dev script to launch foreman (#28242) 2024-03-02 18:31:43 +00:00
Dave MacLeod b6b94c971f
Add Interlingue to available_locales (#28630) 2024-03-01 17:51:22 +00:00
gunchleoc 1d5de8b26a
Add Vai to posting languages (#27136) 2024-03-01 17:41:49 +00:00
gunchleoc 5ab944af95
Rename Panjabi to Punjabi (#27117) 2024-03-01 17:40:48 +00:00
Helge 8d22599318
Add Pennsylvania Dutch to languages dropdown (#26634) 2024-03-01 17:36:00 +00:00
Krzysztof Piwowar b4af3639e8
Add Kashubian to languages dropdown (#26024) 2024-03-01 17:35:35 +00:00
Claire 159e500749 Merge commit '18945f62e07617ac44b7a25a61799b0959fe67f7' into glitch-soc/merge-upstream 2024-03-01 18:34:48 +01:00
Claire c7fc7d0c2a
Merge pull request #2659 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 3389c41b58
2024-03-01 18:34:00 +01:00
Matt Jankowski 18945f62e0
Convert more API specs from controller->request style (#29004) 2024-03-01 16:24:45 +00:00
Daniel M Brasil a25014de8f
Improve IpBlock model test coverage (#29460) 2024-03-01 16:17:40 +00:00
Claire 1d721b21e1
Add attribution to Tabler.io icons used in the new mailer designs (#29470) 2024-03-01 14:51:01 +00:00
HTeuMeuLeu 934cab7508
New welcome email (#28883)
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
2024-03-01 12:16:53 +00:00
Claire f01605c665 Merge commit '3389c41b5899c1da479bfc08e84588184e09902d' into glitch-soc/merge-upstream
Conflicts:
- `app/javascript/packs/admin.tsx`:
  Changes applied to `app/javascript/core/admin.ts` instead.
2024-03-01 13:02:59 +01:00
Matt Jankowski 3389c41b58
Move nobody position in UserRole magic number to constant (#29465) 2024-03-01 11:05:24 +00:00
Claire ec953bf378
Fix regression in handling select elements in packs/admin.tsx (#29469) 2024-03-01 10:16:35 +00:00
Matt Jankowski b9940eb977
Disable codecov comments on PRs (#29464) 2024-02-29 23:25:04 +00:00
Claire 71f673b3e6
Merge pull request #2656 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 958a810553
2024-02-29 20:38:25 +01:00
Claire f6654e0842 Merge commit '958a810553aac6b6cf21d9d107a47b6f68b2a401' into glitch-soc/merge-upstream
Conflicts:
- `app/javascript/packs/admin.jsx`:
  This file was split between `app/javascript/core/admin.js`,
  `app/javascript/pack/admin.jsx`, and
  `app/javascript/flavours/glitch/packs/admin.jsx`.
  Ported upstream's change, splitting the new file to
  `app/javascript/core/admin.ts`, `app/javascript/packs/admin.tsx`,
  and `app/javascript/flavours/glitch/packs/admin.tsx`
2024-02-29 19:02:31 +01:00
Claire a04b384482 [Glitch] Fix regression with search bar icon position
Port edd6aa70e1 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-29 18:30:24 +01:00
Claire bbfcd71118 [Glitch] Fix preview card player getting embedded when clicking on the external link button
Port f24c62a5c8 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-29 18:29:57 +01:00
Renaud Chaput 5b97fdf84c [Glitch] Fix full date display not respecting the locale 12/24h format
Port 4185f3792c to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-29 18:29:11 +01:00
Claire 4d7e7cc562 Merge commit '6dfe318f34d69066dc0f453a228fdfc6af84b62e' into glitch-soc/merge-upstream 2024-02-29 18:24:47 +01:00
Claire 8dbdd7571f
Merge pull request #2655 from TheEssem/fix/open-in
Use upstream's openURL function for search
2024-02-29 18:23:56 +01:00
Claire fd2e46847a
Merge pull request #2610 from glitch-soc/i18n/crowdin/translations
New Crowdin Translations (automated)
2024-02-29 18:20:01 +01:00
Renaud Chaput 958a810553
Convert packs/admin.jsx to Typescript (#29425) 2024-02-29 15:21:03 +00:00
renovate[bot] 6dfe318f34
Update dependency express to v4.18.3 (#29458)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-29 15:20:39 +00:00
Matt Jankowski eb1b8f69de
Allow pagination Link headers on API accounts/statuses when pinned true (#29442) 2024-02-29 14:21:56 +00:00
Claire edd6aa70e1
Fix regression with search bar icon position (#29456) 2024-02-29 13:54:06 +00:00
Claire f24c62a5c8
Fix preview card player getting embedded when clicking on the external link button (#29457) 2024-02-29 13:54:02 +00:00
Matt Jankowski 6675bf574a
Extract parsed_uri_query_values helper in ap/replies controller spec (#29410) 2024-02-29 13:47:38 +00:00
Claire 1c4f36422d Fix bogus translation files 2024-02-29 12:51:22 +01:00
Matt Jankowski e1fcb02867
Align TagServersMeasure to use WITH query style similar to others (#29435) 2024-02-29 11:00:58 +00:00
Matt Jankowski 14c65180df
Use sequence in software_update fabricator to allow multiple (#29438) 2024-02-29 10:51:11 +00:00
Renaud Chaput 4185f3792c
Fix full date display not respecting the locale 12/24h format (#29448) 2024-02-29 09:40:13 +00:00
github-actions[bot] cdf5098166
New Crowdin Translations (automated) (#29452)
Co-authored-by: GitHub Actions <noreply@github.com>
2024-02-29 09:38:33 +00:00
Essem 9242c536d2
Use openURL function from upstream 2024-02-28 23:41:18 -06:00
GitHub Actions ab195bcee1 New Crowdin translations 2024-02-29 04:27:18 +00:00
Claire 0d55610f96
Merge pull request #2653 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 7f84bbfd92
2024-02-28 21:15:34 +01:00
Jeong Arm 4004801ee8 [Glitch] Show comments in the admin/instances page
Port deffb8ecb6 to glitch-soc

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-28 20:38:17 +01:00
Roni Laukkarinen c844817c78 [Glitch] Fix the regression with the search icon position
Port edfc53856f to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-28 20:37:48 +01:00
Claire ccdf56085d Merge commit '7f84bbfd92377689f84121ec45c5b9d809d94cde' into glitch-soc/merge-upstream 2024-02-28 20:37:38 +01:00
renovate[bot] 9324fbe984 [Glitch] Update devDependencies (non-major)
Port dc4427dc9b to glitch-soc

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renaud Chaput <renchap@gmail.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-28 20:30:58 +01:00
Claire 21e7a53ca5 Merge commit '3b3144740805c1b404934c0f196d6cddc14dac0b' into glitch-soc/merge-upstream
Conflicts:
- `package.json`:
  Conflict due to lines adjacent to the glitch-soc-modified `i18n:extract` one
  were changed, but otherwise no real conflict.
  Ported upstream's changes and kept glitch-soc's `i18n:extract`.
- `tsconfig.json`:
  Upstream's dependencies changed the code style rules for json formatting, and
  we had local changes.
  Kept our changes, but with upstream's formatting/
- `yarn.lock`:
  A dependency textually adjacent to a glitch-soc-only one got changed.
  Applied upstream's change, keeping the glitch-soc-only dependency.
2024-02-28 20:27:28 +01:00
Renaud Chaput 0ff9800989 [Glitch] Use modern ES syntax rather than .call
Port 899eac1a92 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-28 20:11:26 +01:00
Claire c2f0ea415e Merge commit '899eac1a92c802c334606a49d538ef37bd47c91a' into glitch-soc/merge-upstream
Conflicts:
- `app/javascript/packs/admin.jsx`:
  Changes split in `app/javascript/core/admin.js` and `app/javascript/flavours/glitch/packs/admin.jsx`.
2024-02-28 20:10:01 +01:00
github-actions[bot] 7f84bbfd92
New Crowdin Translations (automated) (#29430)
Co-authored-by: GitHub Actions <noreply@github.com>
2024-02-28 12:14:42 +00:00
Jeong Arm deffb8ecb6
Show comments in the admin/instances page (#29240)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
2024-02-28 12:07:06 +00:00
Roni Laukkarinen edfc53856f
Fix the regression with the search icon position (#29417) 2024-02-28 12:01:18 +00:00
Claire c19787f3f4
Add doodle feature back (#2652) 2024-02-27 21:27:51 +01:00
Claire a25c900a08
Merge pull request #2650 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 6f7615ba86
2024-02-27 20:36:13 +01:00
Claire e8155319c7 Take advantage of upstream's refactor and reduce code duplication 2024-02-27 19:28:13 +01:00
Claire 916d78373d [Glitch] Change behavior of privacy dropdown to only change value on validation
Port 90573c3abb to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-27 19:24:34 +01:00
Evan Paterakis 1b219e709b [Glitch] Fix filters title and keywords overflow
Port 213c87ae59 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-27 19:24:03 +01:00
Claire a482932649 Merge commit '6f7615ba86afda56e1d661442286a1d68467a525' into glitch-soc/merge-upstream
Conflicts:
- `app/controllers/application_controller.rb`:
  Not a real conflict, upstream fixed a bug in a line adjacent to code
  modified by glitch-soc.
  Ported upstream's change.
2024-02-27 19:20:57 +01:00
Matt Jankowski 8f3c91fc3c
Add change block expectation to admin/invites#deactivate_all spec (#29412) 2024-02-27 16:25:58 +00:00
Matt Jankowski ea8e7f3e9d
Align TagServersMeasure query style with other classes (#29414) 2024-02-27 16:25:12 +00:00
Renaud Chaput 3b31447408
Rework Prettier invocation (#28851) 2024-02-27 16:09:27 +00:00
renovate[bot] dc4427dc9b
Update devDependencies (non-major) (#29089)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renaud Chaput <renchap@gmail.com>
2024-02-27 16:07:43 +00:00
Renaud Chaput 899eac1a92
Use modern ES syntax rather than .call (#29368) 2024-02-27 15:42:05 +00:00
Claire 6f7615ba86
Add basic end-to-end test for admin moderation interface (#29424) 2024-02-27 15:18:06 +00:00
Renaud Chaput 036f5a05e3
Convert the streaming server to ESM (#29389)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
2024-02-27 14:59:20 +00:00
github-actions[bot] bc4c5ed918
New Crowdin Translations (automated) (#29423)
Co-authored-by: GitHub Actions <noreply@github.com>
2024-02-27 14:53:53 +00:00
Matt Jankowski 76d256138e
Wrap media attachment size calculation in COALESCE (#29415) 2024-02-27 11:52:37 +00:00
Matt Jankowski 9e78129e6e
Use "cacheable response" shared example in more places (#29419) 2024-02-27 11:50:21 +00:00
renovate[bot] 54e3a82f1d
Update dependency thor to v1.3.1 (#29421)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-27 11:48:42 +00:00
Claire 90573c3abb
Change behavior of privacy dropdown to only change value on validation (#29406) 2024-02-27 11:41:19 +00:00
Matt Jankowski 9fa7338b6e
Use github reporter on haml-lint runs on CI (#29375) 2024-02-27 10:48:38 +00:00
Evan Paterakis 213c87ae59
Fix filters title and keywords overflow (#29396) 2024-02-27 10:46:58 +00:00
zunda a30cdfd4d4
Specify 410 for code when responding as json while self-destruction (#29420) 2024-02-26 22:43:07 +00:00
Claire e1cb7c9b23
Merge pull request #2649 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 8156113d58
2024-02-26 20:23:28 +01:00
Matt Jankowski 8a80ad7fc4 [Glitch] Remove unused media-spoiler-* JS/CSS
Port c7555271a6 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-26 17:54:58 +01:00
Roni Laukkarinen 20bc633b0c [Glitch] Change new explore compass icon CSS class to explore
Port 10fdd88288 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-26 17:54:58 +01:00
Roni Laukkarinen 3fc4859279 [Glitch] Fix search icon position on mobile
Port 1cb74eeec0 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-26 17:54:58 +01:00
Roni Laukkarinen 658911c268 [Glitch] Improve alt text form accessibility with long texts
Port bbf6cb66f6 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-26 17:54:58 +01:00
Eugen Rochko f6903d9ab0 [Glitch] Change explore icon from hashtag to compass in web UI
Port b8b2f20b16 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-26 17:54:58 +01:00
Claire 67ca8bb56a Merge commit '8156113d58db851d00f8052e66459e6dafb71e82' into glitch-soc/merge-upstream
Conflicts:
- `app/javascript/packs/admin.jsx`:
  Change applied to `app/javascript/core/admin.js` instead.
2024-02-26 17:43:16 +01:00
Matt Jankowski 8156113d58
Use response_vary_headers method in requests/cache_spec (#29411) 2024-02-26 16:27:07 +00:00
Damien Mathieu 1540f42522
Better tests for auth/registrations#update (#29303) 2024-02-26 16:09:56 +00:00
Wolfgang Fournès d51c3ac087
Add a missing spec to SessionsController#webauthn_options (#29277) 2024-02-26 16:09:40 +00:00
Matt Jankowski c7555271a6
Remove unused media-spoiler-* JS/CSS (#29407) 2024-02-26 15:30:58 +00:00
Roni Laukkarinen 10fdd88288
Change new explore compass icon CSS class to explore (#29395) 2024-02-26 15:28:38 +00:00
Matt Jankowski 8429d07454
Add RankedTrend concern for trends classes (#29388) 2024-02-26 13:45:39 +00:00
github-actions[bot] 98e3dc2578
New Crowdin Translations (automated) (#29382)
Co-authored-by: GitHub Actions <noreply@github.com>
2024-02-26 13:03:06 +00:00
renovate[bot] b829d261ba
Update DefinitelyTyped types (non-major) (#29404)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-26 12:52:03 +00:00
renovate[bot] e57d321097
Update dependency httplog to v1.6.3 (#29399)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-26 12:51:37 +00:00
Jason Punyon 1ad3cffaea
Missed a .to_date (#29390) 2024-02-26 12:42:09 +00:00
renovate[bot] 8fd8b30c24
Update dependency cssnano to v6.0.5 (#29385)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-26 12:41:34 +00:00
Roni Laukkarinen 1cb74eeec0
Fix search icon position on mobile (#29384) 2024-02-26 00:57:48 +00:00
Roni Laukkarinen bbf6cb66f6
Improve alt text form accessibility with long texts (#27095) 2024-02-26 00:57:13 +00:00
Paolo Melchiorre aca691726b
Fix #21492 Add missing WebP hint in avatar/header localizations (#22395) 2024-02-23 22:10:46 +00:00
945 changed files with 20550 additions and 11284 deletions

View file

@ -1,7 +1,9 @@
[production]
defaults
not IE 11
> 0.2%
ios >= 15.6
not dead
not OperaMini all
[development]
supports es6-module

View file

@ -5,7 +5,7 @@
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
"ghcr.io/devcontainers/features/sshd:1": {},
"ghcr.io/devcontainers/features/sshd:1": {}
},
"runServices": ["app", "db", "redis"],
@ -15,16 +15,16 @@
"portsAttributes": {
"3000": {
"label": "web",
"onAutoForward": "notify",
"onAutoForward": "notify"
},
"4000": {
"label": "stream",
"onAutoForward": "silent",
},
"onAutoForward": "silent"
}
},
"otherPortsAttributes": {
"onAutoForward": "silent",
"onAutoForward": "silent"
},
"remoteEnv": {
@ -33,7 +33,7 @@
"STREAMING_API_BASE_URL": "https://${localEnv:CODESPACE_NAME}-4000.app.github.dev",
"DISABLE_FORGERY_REQUEST_PROTECTION": "true",
"ES_ENABLED": "",
"LIBRE_TRANSLATE_ENDPOINT": "",
"LIBRE_TRANSLATE_ENDPOINT": ""
},
"onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
@ -43,7 +43,7 @@
"customizations": {
"vscode": {
"settings": {},
"extensions": ["EditorConfig.EditorConfig", "webben.browserslist"],
},
},
"extensions": ["EditorConfig.EditorConfig", "webben.browserslist"]
}
}
}

View file

@ -5,7 +5,7 @@
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
"ghcr.io/devcontainers/features/sshd:1": {},
"ghcr.io/devcontainers/features/sshd:1": {}
},
"forwardPorts": [3000, 4000],
@ -14,17 +14,17 @@
"3000": {
"label": "web",
"onAutoForward": "notify",
"requireLocalPort": true,
"requireLocalPort": true
},
"4000": {
"label": "stream",
"onAutoForward": "silent",
"requireLocalPort": true,
},
"requireLocalPort": true
}
},
"otherPortsAttributes": {
"onAutoForward": "silent",
"onAutoForward": "silent"
},
"onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
@ -34,7 +34,7 @@
"customizations": {
"vscode": {
"settings": {},
"extensions": ["EditorConfig.EditorConfig", "webben.browserslist"],
},
},
"extensions": ["EditorConfig.EditorConfig", "webben.browserslist"]
}
}
}

View file

@ -70,7 +70,7 @@ services:
hard: -1
libretranslate:
image: libretranslate/libretranslate:v1.5.5
image: libretranslate/libretranslate:v1.5.6
restart: unless-stopped
volumes:
- lt-data:/home/libretranslate/.local

View file

@ -123,7 +123,7 @@ module.exports = defineConfig({
'react/react-in-jsx-scope': 'off', // not needed with new JSX transform
'react/self-closing-comp': 'error',
// recommended values found in https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/index.js
// recommended values found in https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/v6.8.0/src/index.js#L46
'jsx-a11y/accessible-emoji': 'warn',
'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/label-has-associated-control': 'off',
@ -176,7 +176,7 @@ module.exports = defineConfig({
},
],
// See https://github.com/import-js/eslint-plugin-import/blob/main/config/recommended.js
// See https://github.com/import-js/eslint-plugin-import/blob/v2.29.1/config/recommended.js
'import/extensions': [
'error',
'always',
@ -355,7 +355,6 @@ module.exports = defineConfig({
'plugin:import/typescript',
'plugin:promise/recommended',
'plugin:jsdoc/recommended-typescript',
'plugin:prettier/recommended',
],
parserOptions: {
@ -364,6 +363,9 @@ module.exports = defineConfig({
},
rules: {
// Disable formatting rules that have been enabled in the base config
'indent': 'off',
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'@typescript-eslint/consistent-type-definitions': ['warn', 'interface'],

4
.github/codecov.yml vendored
View file

@ -1,3 +1,4 @@
comment: false # Do not leave PR comments
coverage:
status:
project:
@ -8,6 +9,3 @@ coverage:
default:
# Github status check is not blocking
informational: true
comment:
# Only write a comment in PR if there are changes
require_changes: true

View file

@ -53,7 +53,7 @@ jobs:
# Create or update the pull request
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6.0.0
uses: peter-evans/create-pull-request@v6.0.2
with:
commit-message: 'New Crowdin translations'
title: 'New Crowdin Translations (automated)'

18
.github/workflows/format-check.yml vendored Normal file
View file

@ -0,0 +1,18 @@
name: Check formatting
on:
push:
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Javascript environment
uses: ./.github/actions/setup-javascript
- name: Check formatting with Prettier
run: yarn format:check

View file

@ -43,4 +43,4 @@ jobs:
- run: echo "::add-matcher::.github/stylelint-matcher.json"
- name: Stylelint
run: yarn lint:sass
run: yarn lint:css

View file

@ -36,4 +36,4 @@ jobs:
- name: Run haml-lint
run: |
echo "::add-matcher::.github/workflows/haml-lint-problem-matcher.json"
bundle exec haml-lint
bundle exec haml-lint --reporter github

View file

@ -1,38 +0,0 @@
name: JSON Linting
on:
push:
branches-ignore:
- 'dependabot/**'
- 'renovate/**'
paths:
- 'package.json'
- 'yarn.lock'
- '.nvmrc'
- '.prettier*'
- '**/*.json'
- '.github/workflows/lint-json.yml'
- '!app/javascript/mastodon/locales/*.json'
pull_request:
paths:
- 'package.json'
- 'yarn.lock'
- '.nvmrc'
- '.prettier*'
- '**/*.json'
- '.github/workflows/lint-json.yml'
- '!app/javascript/mastodon/locales/*.json'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Javascript environment
uses: ./.github/actions/setup-javascript
- name: Prettier
run: yarn lint:json

View file

@ -1,38 +0,0 @@
name: Markdown Linting
on:
push:
branches-ignore:
- 'dependabot/**'
- 'renovate/**'
paths:
- '.github/workflows/lint-md.yml'
- '.nvmrc'
- '.prettier*'
- '**/*.md'
- '!AUTHORS.md'
- 'package.json'
- 'yarn.lock'
pull_request:
paths:
- '.github/workflows/lint-md.yml'
- '.nvmrc'
- '.prettier*'
- '**/*.md'
- '!AUTHORS.md'
- 'package.json'
- 'yarn.lock'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Javascript environment
uses: ./.github/actions/setup-javascript
- name: Prettier
run: yarn lint:md

View file

@ -1,40 +0,0 @@
name: YML Linting
on:
push:
branches-ignore:
- 'dependabot/**'
- 'renovate/**'
paths:
- 'package.json'
- 'yarn.lock'
- '.nvmrc'
- '.prettier*'
- '**/*.yaml'
- '**/*.yml'
- '.github/workflows/lint-yml.yml'
- '!config/locales/*.yml'
pull_request:
paths:
- 'package.json'
- 'yarn.lock'
- '.nvmrc'
- '.prettier*'
- '**/*.yaml'
- '**/*.yml'
- '.github/workflows/lint-yml.yml'
- '!config/locales/*.yml'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Javascript environment
uses: ./.github/actions/setup-javascript
- name: Prettier
run: yarn lint:yml

View file

@ -14,3 +14,5 @@ linters:
enabled: true
LineLength:
max: 320
ViewLength:
max: 200 # Override default value of 100 inherited from rubocop

View file

@ -1,13 +0,0 @@
# This configuration was generated by
# `haml-lint --auto-gen-config`
# on 2024-01-09 11:30:07 -0500 using Haml-Lint version 0.53.0.
# The point is for the user to remove these configuration records
# one by one as the lints are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of Haml-Lint, may require this file to be generated again.
linters:
# Offense count: 1
LineLength:
exclude:
- 'app/views/admin/roles/_form.html.haml'

View file

@ -54,6 +54,13 @@
# Ignore Docker option files
docker-compose.override.yml
# Ignore public
/public/assets
/public/emoji
/public/packs
/public/packs-test
/public/system
# Ignore emoji map file
/app/javascript/mastodon/features/emoji/emoji_map.json
@ -74,6 +81,7 @@ app/javascript/styles/mastodon/reset.scss
# Ignore the generated AUTHORS.md
AUTHORS.md
# Process a few selected JS files
!lint-staged.config.js
# Ignore glitch-soc emoji map file

View file

@ -20,7 +20,7 @@ FROM docker.io/ruby:${RUBY_VERSION}-slim-${DEBIAN_VERSION} as ruby
# Resulting version string is vX.X.X-MASTODON_VERSION_PRERELEASE+MASTODON_VERSION_METADATA
# Example: v4.2.0-nightly.2023.11.09+something
# Overwrite existance of 'alpha.0' in version.rb [--build-arg MASTODON_VERSION_PRERELEASE="nightly.2023.11.09"]
# Overwrite existence of 'alpha.0' in version.rb [--build-arg MASTODON_VERSION_PRERELEASE="nightly.2023.11.09"]
ARG MASTODON_VERSION_PRERELEASE=""
# Append build metadata or fork information to version.rb [--build-arg MASTODON_VERSION_METADATA="something"]
ARG MASTODON_VERSION_METADATA=""
@ -29,7 +29,7 @@ ARG MASTODON_VERSION_METADATA=""
# See: https://docs.joinmastodon.org/admin/config/#rails_serve_static_files
ARG RAILS_SERVE_STATIC_FILES="true"
# Allow to use YJIT compiler
# See: https://github.com/ruby/ruby/blob/master/doc/yjit/yjit.md
# See: https://github.com/ruby/ruby/blob/v3_2_3/doc/yjit/yjit.md
ARG RUBY_YJIT_ENABLE="1"
# Timezone used by the Docker container and runtime, change with [--build-arg TZ=Europe/Berlin]
ARG TZ="Etc/UTC"

View file

@ -59,6 +59,7 @@ gem 'http', '~> 5.1'
gem 'http_accept_language', '~> 2.1'
gem 'httplog', '~> 1.6.2'
gem 'idn-ruby', require: 'idn'
gem 'inline_svg'
gem 'kaminari', '~> 1.2'
gem 'link_header', '~> 0.0'
gem 'mime-types', '~> 3.5.0', require: 'mime/types/columnar'
@ -112,7 +113,7 @@ group :test do
# RSpec helpers for email specs
gem 'email_spec'
# Extra RSpec extenion methods and helpers for sidekiq
# Extra RSpec extension methods and helpers for sidekiq
gem 'rspec-sidekiq', '~> 4.0'
# Browser integration testing

View file

@ -333,7 +333,7 @@ GEM
http-form_data (2.3.0)
http_accept_language (2.1.1)
httpclient (2.8.3)
httplog (1.6.2)
httplog (1.6.3)
rack (>= 2.0)
rainbow (>= 2.0.0)
i18n (1.14.1)
@ -350,14 +350,17 @@ GEM
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
idn-ruby (0.1.5)
inline_svg (1.9.0)
activesupport (>= 3.0)
nokogiri (>= 1.6)
io-console (0.7.2)
irb (1.11.2)
irb (1.12.0)
rdoc
reline (>= 0.4.2)
jmespath (1.6.2)
json (2.7.1)
json-canonicalization (1.0.0)
json-jwt (1.15.3)
json-jwt (1.15.3.1)
activesupport (>= 4.2)
aes_key_wrap
bindata
@ -372,7 +375,7 @@ GEM
json-ld-preloaded (3.3.0)
json-ld (~> 3.3)
rdf (~> 3.3)
json-schema (4.1.1)
json-schema (4.2.0)
addressable (>= 2.8)
jsonapi-renderer (0.2.2)
jwt (2.7.1)
@ -455,7 +458,7 @@ GEM
net-smtp (0.4.0.1)
net-protocol
nio4r (2.5.9)
nokogiri (1.16.2)
nokogiri (1.16.3)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nsa (0.3.0)
@ -465,11 +468,11 @@ GEM
statsd-ruby (~> 1.4, >= 1.4.0)
oj (3.16.3)
bigdecimal (>= 3.0)
omniauth (2.1.1)
omniauth (2.1.2)
hashie (>= 3.4.6)
rack (>= 2.2.3)
rack-protection
omniauth-cas (3.0.0.beta.1)
omniauth-cas (3.0.0)
addressable (~> 2.8)
nokogiri (~> 1.12)
omniauth (~> 2.1)
@ -505,7 +508,7 @@ GEM
parslet (2.0.0)
pastel (0.8.0)
tty-color (~> 0.5)
pg (1.5.5)
pg (1.5.6)
pghero (3.4.1)
activerecord (>= 6)
posix-spawn (0.3.15)
@ -535,7 +538,7 @@ GEM
rack (2.2.8.1)
rack-attack (6.7.0)
rack (>= 1.0, < 4)
rack-cors (2.0.1)
rack-cors (2.0.2)
rack (>= 2.0.0)
rack-oauth2 (1.21.3)
activesupport
@ -543,8 +546,9 @@ GEM
httpclient
json-jwt (>= 1.11.0)
rack (>= 2.1.0)
rack-protection (3.0.5)
rack
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
rack-proxy (0.7.6)
rack
rack-session (1.0.2)
@ -606,7 +610,7 @@ GEM
redlock (1.3.2)
redis (>= 3.0.0, < 6.0)
regexp_parser (2.9.0)
reline (0.4.2)
reline (0.4.3)
io-console (~> 0.5)
request_store (1.5.1)
rack (>= 1.4)
@ -621,16 +625,16 @@ GEM
chunky_png (~> 1.0)
rqrcode_core (~> 1.0)
rqrcode_core (1.2.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (~> 3.13.0)
rspec-github (2.4.0)
rspec-core (~> 3.0)
rspec-mocks (3.12.6)
rspec-mocks (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.1)
actionpack (>= 6.1)
activesupport (>= 6.1)
@ -644,7 +648,7 @@ GEM
rspec-expectations (~> 3.0)
rspec-mocks (~> 3.0)
sidekiq (>= 5, < 8)
rspec-support (3.12.1)
rspec-support (3.13.1)
rubocop (1.60.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
@ -743,8 +747,8 @@ GEM
unicode-display_width (>= 1.1.1, < 3)
terrapin (1.0.1)
climate_control
test-prof (1.3.1)
thor (1.3.0)
test-prof (1.3.2)
thor (1.3.1)
tilt (2.3.0)
timeout (0.4.1)
tpm-key_attestation (0.12.0)
@ -864,6 +868,7 @@ DEPENDENCIES
httplog (~> 1.6.2)
i18n-tasks (~> 1.0)
idn-ruby
inline_svg
irb (~> 1.8)
json-ld
json-ld-preloaded (~> 3.2)

152
README.md
View file

@ -1,14 +1,154 @@
# Mastodon Glitch Edition
> Now with automated deploys!
[![Ruby Testing](https://github.com/glitch-soc/mastodon/actions/workflows/test-ruby.yml/badge.svg)](https://github.com/glitch-soc/mastodon/actions/workflows/test-ruby.yml)
[![Crowdin](https://badges.crowdin.net/glitch-soc/localized.svg)][glitch-crowdin]
[![Build Status](https://img.shields.io/circleci/project/github/glitch-soc/mastodon.svg)][circleci]
[![Code Climate](https://img.shields.io/codeclimate/maintainability/glitch-soc/mastodon.svg)][code_climate]
[circleci]: https://circleci.com/gh/glitch-soc/mastodon
[code_climate]: https://codeclimate.com/github/glitch-soc/mastodon
[glitch-crowdin]: https://crowdin.com/project/glitch-soc
So here's the deal: we all work on this code, and anyone who uses that does so absolutely at their own risk. can you dig it?
- You can view documentation for this project at [glitch-soc.github.io/docs/](https://glitch-soc.github.io/docs/).
- And contributing guidelines are available [here](CONTRIBUTING.md) and [here](https://glitch-soc.github.io/docs/contributing/).
Mastodon Glitch Edition is a fork of [Mastodon](https://github.com/mastodon/mastodon). Upstream's README file is reproduced below.
---
<h1><picture>
<source media="(prefers-color-scheme: dark)" srcset="./lib/assets/wordmark.dark.png?raw=true">
<source media="(prefers-color-scheme: light)" srcset="./lib/assets/wordmark.light.png?raw=true">
<img alt="Mastodon" src="./lib/assets/wordmark.light.png?raw=true" height="34">
</picture></h1>
[![GitHub release](https://img.shields.io/github/release/mastodon/mastodon.svg)][releases]
[![Ruby Testing](https://github.com/mastodon/mastodon/actions/workflows/test-ruby.yml/badge.svg)](https://github.com/mastodon/mastodon/actions/workflows/test-ruby.yml)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/mastodon/localized.svg)][crowdin]
[releases]: https://github.com/mastodon/mastodon/releases
[crowdin]: https://crowdin.com/project/mastodon
Mastodon is a **free, open-source social network server** based on ActivityPub where users can follow friends and discover new ones. On Mastodon, users can publish anything they want: links, pictures, text, and video. All Mastodon servers are interoperable as a federated network (users on one server can seamlessly communicate with users from another one, including non-Mastodon software that implements ActivityPub!)
Click below to **learn more** in a video:
[![Screenshot](https://blog.joinmastodon.org/2018/06/why-activitypub-is-the-future/ezgif-2-60f1b00403.gif)][youtube_demo]
[youtube_demo]: https://www.youtube.com/watch?v=IPSbNdBmWKE
## Navigation
- [Project homepage 🐘](https://joinmastodon.org)
- [Support the development via Patreon][patreon]
- [View sponsors](https://joinmastodon.org/sponsors)
- [Blog](https://blog.joinmastodon.org)
- [Documentation](https://docs.joinmastodon.org)
- [Roadmap](https://joinmastodon.org/roadmap)
- [Official Docker image](https://github.com/mastodon/mastodon/pkgs/container/mastodon)
- [Browse Mastodon servers](https://joinmastodon.org/communities)
- [Browse Mastodon apps](https://joinmastodon.org/apps)
[patreon]: https://www.patreon.com/mastodon
## Features
<img src="/app/javascript/images/elephant_ui_working.svg?raw=true" align="right" width="30%" />
### No vendor lock-in: Fully interoperable with any conforming platform
It doesn't have to be Mastodon; whatever implements ActivityPub is part of the social network! [Learn more](https://blog.joinmastodon.org/2018/06/why-activitypub-is-the-future/)
### Real-time, chronological timeline updates
Updates of people you're following appear in real-time in the UI via WebSockets. There's a firehose view as well!
### Media attachments like images and short videos
Upload and view images and WebM/MP4 videos attached to the updates. Videos with no audio track are treated like GIFs; normal videos loop continuously!
### Safety and moderation tools
Mastodon includes private posts, locked accounts, phrase filtering, muting, blocking, and all sorts of other features, along with a reporting and moderation system. [Learn more](https://blog.joinmastodon.org/2018/07/cage-the-mastodon/)
### OAuth2 and a straightforward REST API
Mastodon acts as an OAuth2 provider, so 3rd party apps can use the REST and Streaming APIs. This results in a rich app ecosystem with a lot of choices!
## Deployment
### Tech stack
- **Ruby on Rails** powers the REST API and other web pages
- **React.js** and Redux are used for the dynamic parts of the interface
- **Node.js** powers the streaming API
### Requirements
- **PostgreSQL** 12+
- **Redis** 4+
- **Ruby** 3.0+
- **Node.js** 16+
The repository includes deployment configurations for **Docker and docker-compose** as well as specific platforms like **Heroku**, **Scalingo**, and **Nanobox**. For Helm charts, reference the [mastodon/chart repository](https://github.com/mastodon/chart). The [**standalone** installation guide](https://docs.joinmastodon.org/admin/install/) is available in the documentation.
## Development
### Vagrant
A **Vagrant** configuration is included for development purposes. To use it, complete the following steps:
- Install Vagrant and Virtualbox
- Install the `vagrant-hostsupdater` plugin: `vagrant plugin install vagrant-hostsupdater`
- Run `vagrant up`
- Run `vagrant ssh -c "cd /vagrant && bin/dev"`
- Open `http://mastodon.local` in your browser
### MacOS
To set up **MacOS** for native development, complete the following steps:
- Use a Ruby version manager to install the specified version from `.ruby-version`
- Run `brew install postgresql@14 redis imagemagick libidn` to install required dependencies
- Navigate to Mastodon's root directory and run `brew install nvm` then `nvm use` to use the version from `.nvmrc`
- Run `corepack enable && corepack prepare`
- Run `bundle exec rails db:setup` (optionally prepend `RAILS_ENV=development` to target the dev environment)
- Finally, run `bin/dev` which will launch the local services via `overmind` (if installed) or `foreman`
### Docker
For development with **Docker**, complete the following steps:
- Install Docker Desktop
- Run `docker compose -f .devcontainer/docker-compose.yml up -d`
- Run `docker compose -f .devcontainer/docker-compose.yml exec app .devcontainer/post-create.sh`
- Finally, run `docker compose -f .devcontainer/docker-compose.yml exec app bin/dev`
If you are using an IDE with [support for the Development Container specification](https://containers.dev/supporting), it will run the above `docker compose` commands automatically. For **Visual Studio Code** this requires the [Dev Container extension](https://containers.dev/supporting#dev-containers).
### GitHub Codespaces
To get you coding in just a few minutes, GitHub Codespaces provides a web-based version of Visual Studio Code and a cloud-hosted development environment fully configured with the software needed for this project..
- Click this button to create a new codespace:<br>
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=52281283&devcontainer_path=.devcontainer%2Fcodespaces%2Fdevcontainer.json)
- Wait for the environment to build. This will take a few minutes.
- When the editor is ready, run `bin/dev` in the terminal.
- After a few seconds, a popup will appear with a button labeled _Open in Browser_. This will open Mastodon.
- On the _Ports_ tab, right click on the “stream” row and select _Port visibility__Public_.
## Contributing
Mastodon is **free, open-source software** licensed under **AGPLv3**.
You can open issues for bugs you've found or features you think are missing. You can also submit pull requests to this repository or submit translations using Crowdin. To get started, take a look at [CONTRIBUTING.md](CONTRIBUTING.md). If your contributions are accepted into Mastodon, you can request to be paid through [our OpenCollective](https://opencollective.com/mastodon).
**IRC channel**: #mastodon on irc.libera.chat
## License
Copyright (C) 2016-2024 Eugen Rochko & other Mastodon contributors (see [AUTHORS.md](AUTHORS.md))
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

2
Vagrantfile vendored
View file

@ -188,7 +188,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.post_up_message = <<MESSAGE
To start server
$ vagrant ssh -c "cd /vagrant && foreman start"
$ vagrant ssh -c "cd /vagrant && bin/dev"
MESSAGE
end

View file

@ -1,6 +1,9 @@
# frozen_string_literal: true
class ActivityPub::BaseController < Api::BaseController
include SignatureVerification
include AccountOwnedConcern
skip_before_action :require_authenticated_user!
skip_before_action :require_not_suspended!
skip_around_action :set_locale

View file

@ -1,9 +1,6 @@
# frozen_string_literal: true
class ActivityPub::ClaimsController < ActivityPub::BaseController
include SignatureVerification
include AccountOwnedConcern
skip_before_action :authenticate_user!
before_action :require_account_signature!

View file

@ -1,9 +1,6 @@
# frozen_string_literal: true
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?

View file

@ -1,9 +1,6 @@
# frozen_string_literal: true
class ActivityPub::FollowersSynchronizationsController < ActivityPub::BaseController
include SignatureVerification
include AccountOwnedConcern
vary_by -> { 'Signature' if authorized_fetch_mode? }
before_action :require_account_signature!

View file

@ -1,9 +1,7 @@
# frozen_string_literal: true
class ActivityPub::InboxesController < ActivityPub::BaseController
include SignatureVerification
include JsonLdHelper
include AccountOwnedConcern
before_action :skip_unknown_actor_activity
before_action :require_actor_signature!

View file

@ -3,9 +3,6 @@
class ActivityPub::OutboxesController < ActivityPub::BaseController
LIMIT = 20
include SignatureVerification
include AccountOwnedConcern
vary_by -> { 'Signature' if authorized_fetch_mode? || page_requested? }
before_action :require_account_signature!, if: :authorized_fetch_mode?

View file

@ -1,9 +1,7 @@
# frozen_string_literal: true
class ActivityPub::RepliesController < ActivityPub::BaseController
include SignatureVerification
include Authorization
include AccountOwnedConcern
DESCENDANTS_LIMIT = 60

View file

@ -128,7 +128,7 @@ module Admin
def unblock_email
authorize @account, :unblock_email?
CanonicalEmailBlock.where(reference_account: @account).delete_all
CanonicalEmailBlock.matching_account(@account).delete_all
log_action :unblock_email, @account

View file

@ -53,7 +53,7 @@ module Admin
end
def resource_params
params.require(:rule).permit(:text, :priority)
params.require(:rule).permit(:text, :hint, :priority)
end
end
end

View file

@ -8,6 +8,7 @@ class Api::BaseController < ApplicationController
include Api::AccessTokenTrackingConcern
include Api::CachingConcern
include Api::ContentSecurityPolicy
include Api::ErrorHandling
skip_before_action :require_functional!, unless: :limited_federation_mode?
@ -18,51 +19,6 @@ class Api::BaseController < ApplicationController
protect_from_forgery with: :null_session
rescue_from ActiveRecord::RecordInvalid, Mastodon::ValidationError do |e|
render json: { error: e.to_s }, status: 422
end
rescue_from ActiveRecord::RecordNotUnique do
render json: { error: 'Duplicate record' }, status: 422
end
rescue_from Date::Error do
render json: { error: 'Invalid date supplied' }, status: 422
end
rescue_from ActiveRecord::RecordNotFound do
render json: { error: 'Record not found' }, status: 404
end
rescue_from HTTP::Error, Mastodon::UnexpectedResponseError do
render json: { error: 'Remote data could not be fetched' }, status: 503
end
rescue_from OpenSSL::SSL::SSLError do
render json: { error: 'Remote SSL certificate could not be verified' }, status: 503
end
rescue_from Mastodon::NotPermittedError do
render json: { error: 'This action is not allowed' }, status: 403
end
rescue_from Seahorse::Client::NetworkingError do |e|
Rails.logger.warn "Storage server error: #{e}"
render json: { error: 'There was a temporary problem serving your request, please try again' }, status: 503
end
rescue_from Mastodon::RaceConditionError, Stoplight::Error::RedLight do
render json: { error: 'There was a temporary problem serving your request, please try again' }, status: 503
end
rescue_from Mastodon::RateLimitExceededError do
render json: { error: I18n.t('errors.429') }, status: 429
end
rescue_from ActionController::ParameterMissing, Mastodon::InvalidParameterError do |e|
render json: { error: e.to_s }, status: 400
end
def doorkeeper_unauthorized_render_options(error: nil)
{ json: { error: error.try(:description) || 'Not authorized' } }
end
@ -73,6 +29,14 @@ class Api::BaseController < ApplicationController
protected
def pagination_max_id
pagination_collection.last.id
end
def pagination_since_id
pagination_collection.first.id
end
def set_pagination_headers(next_path = nil, prev_path = nil)
links = []
links << [next_path, [%w(rel next)]] if next_path
@ -140,6 +104,10 @@ class Api::BaseController < ApplicationController
private
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def pagination_options_invalid?
params.slice(:limit, :offset).values.map(&:to_i).any?(&:negative?)
end

View file

@ -41,10 +41,6 @@ class Api::V1::Accounts::FollowerAccountsController < Api::BaseController
)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_account_followers_url pagination_params(max_id: pagination_max_id) if records_continue?
end

View file

@ -41,10 +41,6 @@ class Api::V1::Accounts::FollowingAccountsController < Api::BaseController
)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_account_following_index_url pagination_params(max_id: pagination_max_id) if records_continue?
end

View file

@ -4,7 +4,7 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
before_action -> { authorize_if_got_token! :read, :'read:statuses' }
before_action :set_account
after_action :insert_pagination_headers, unless: -> { truthy_param?(:pinned) }
after_action :insert_pagination_headers
def index
cache_if_unauthenticated!
@ -35,10 +35,6 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
params.slice(:limit, *AccountStatusesFilter::KEYS).permit(:limit, *AccountStatusesFilter::KEYS).merge(core_params)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_account_statuses_url pagination_params(max_id: pagination_max_id) if records_continue?
end
@ -51,11 +47,7 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
@statuses.size == limit_param(DEFAULT_STATUSES_LIMIT)
end
def pagination_max_id
@statuses.last.id
end
def pagination_since_id
@statuses.first.id
def pagination_collection
@statuses
end
end

View file

@ -125,10 +125,6 @@ class Api::V1::Admin::AccountsController < Api::BaseController
translated_params
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_admin_accounts_url(pagination_params(max_id: pagination_max_id)) if records_continue?
end
@ -137,12 +133,8 @@ class Api::V1::Admin::AccountsController < Api::BaseController
api_v1_admin_accounts_url(pagination_params(min_id: pagination_since_id)) unless @accounts.empty?
end
def pagination_max_id
@accounts.last.id
end
def pagination_since_id
@accounts.first.id
def pagination_collection
@accounts
end
def records_continue?

View file

@ -65,10 +65,6 @@ class Api::V1::Admin::CanonicalEmailBlocksController < Api::BaseController
@canonical_email_block = CanonicalEmailBlock.find(params[:id])
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_admin_canonical_email_blocks_url(pagination_params(max_id: pagination_max_id)) if records_continue?
end
@ -77,12 +73,8 @@ class Api::V1::Admin::CanonicalEmailBlocksController < Api::BaseController
api_v1_admin_canonical_email_blocks_url(pagination_params(min_id: pagination_since_id)) unless @canonical_email_blocks.empty?
end
def pagination_max_id
@canonical_email_blocks.last.id
end
def pagination_since_id
@canonical_email_blocks.first.id
def pagination_collection
@canonical_email_blocks
end
def records_continue?

View file

@ -61,10 +61,6 @@ class Api::V1::Admin::DomainAllowsController < Api::BaseController
DomainAllow.all
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_admin_domain_allows_url(pagination_params(max_id: pagination_max_id)) if records_continue?
end
@ -73,12 +69,8 @@ class Api::V1::Admin::DomainAllowsController < Api::BaseController
api_v1_admin_domain_allows_url(pagination_params(min_id: pagination_since_id)) unless @domain_allows.empty?
end
def pagination_max_id
@domain_allows.last.id
end
def pagination_since_id
@domain_allows.first.id
def pagination_collection
@domain_allows
end
def records_continue?

View file

@ -72,10 +72,6 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
params.permit(:severity, :reject_media, :reject_reports, :private_comment, :public_comment, :obfuscate)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_admin_domain_blocks_url(pagination_params(max_id: pagination_max_id)) if records_continue?
end
@ -84,12 +80,8 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
api_v1_admin_domain_blocks_url(pagination_params(min_id: pagination_since_id)) unless @domain_blocks.empty?
end
def pagination_max_id
@domain_blocks.last.id
end
def pagination_since_id
@domain_blocks.first.id
def pagination_collection
@domain_blocks
end
def records_continue?

View file

@ -58,10 +58,6 @@ class Api::V1::Admin::EmailDomainBlocksController < Api::BaseController
params.permit(:domain, :allow_with_approval)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_admin_email_domain_blocks_url(pagination_params(max_id: pagination_max_id)) if records_continue?
end
@ -70,12 +66,8 @@ class Api::V1::Admin::EmailDomainBlocksController < Api::BaseController
api_v1_admin_email_domain_blocks_url(pagination_params(min_id: pagination_since_id)) unless @email_domain_blocks.empty?
end
def pagination_max_id
@email_domain_blocks.last.id
end
def pagination_since_id
@email_domain_blocks.first.id
def pagination_collection
@email_domain_blocks
end
def records_continue?

View file

@ -63,10 +63,6 @@ class Api::V1::Admin::IpBlocksController < Api::BaseController
params.permit(:ip, :severity, :comment, :expires_in)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_admin_ip_blocks_url(pagination_params(max_id: pagination_max_id)) if records_continue?
end
@ -75,12 +71,8 @@ class Api::V1::Admin::IpBlocksController < Api::BaseController
api_v1_admin_ip_blocks_url(pagination_params(min_id: pagination_since_id)) unless @ip_blocks.empty?
end
def pagination_max_id
@ip_blocks.last.id
end
def pagination_since_id
@ip_blocks.first.id
def pagination_collection
@ip_blocks
end
def records_continue?

View file

@ -89,10 +89,6 @@ class Api::V1::Admin::ReportsController < Api::BaseController
params.permit(*FILTER_PARAMS)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_admin_reports_url(pagination_params(max_id: pagination_max_id)) if records_continue?
end
@ -101,12 +97,8 @@ class Api::V1::Admin::ReportsController < Api::BaseController
api_v1_admin_reports_url(pagination_params(min_id: pagination_since_id)) unless @reports.empty?
end
def pagination_max_id
@reports.last.id
end
def pagination_since_id
@reports.first.id
def pagination_collection
@reports
end
def records_continue?

View file

@ -44,10 +44,6 @@ class Api::V1::Admin::TagsController < Api::BaseController
params.permit(:display_name, :trendable, :usable, :listable)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_admin_tags_url(pagination_params(max_id: pagination_max_id)) if records_continue?
end
@ -56,12 +52,8 @@ class Api::V1::Admin::TagsController < Api::BaseController
api_v1_admin_tags_url(pagination_params(min_id: pagination_since_id)) unless @tags.empty?
end
def pagination_max_id
@tags.last.id
end
def pagination_since_id
@tags.first.id
def pagination_collection
@tags
end
def records_continue?

View file

@ -42,10 +42,6 @@ class Api::V1::Admin::Trends::Links::PreviewCardProvidersController < Api::BaseC
@providers = PreviewCardProvider.all.to_a_paginated_by_id(limit_param(LIMIT), params_slice(:max_id, :since_id, :min_id))
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_admin_trends_links_preview_card_providers_url(pagination_params(max_id: pagination_max_id)) if records_continue?
end
@ -54,12 +50,8 @@ class Api::V1::Admin::Trends::Links::PreviewCardProvidersController < Api::BaseC
api_v1_admin_trends_links_preview_card_providers_url(pagination_params(min_id: pagination_since_id)) unless @providers.empty?
end
def pagination_max_id
@providers.last.id
end
def pagination_since_id
@providers.first.id
def pagination_collection
@providers
end
def records_continue?

View file

@ -28,10 +28,6 @@ class Api::V1::BlocksController < Api::BaseController
)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_blocks_url pagination_params(max_id: pagination_max_id) if records_continue?
end
@ -40,12 +36,8 @@ class Api::V1::BlocksController < Api::BaseController
api_v1_blocks_url pagination_params(since_id: pagination_since_id) unless paginated_blocks.empty?
end
def pagination_max_id
paginated_blocks.last.id
end
def pagination_since_id
paginated_blocks.first.id
def pagination_collection
paginated_blocks
end
def records_continue?

View file

@ -31,10 +31,6 @@ class Api::V1::BookmarksController < Api::BaseController
current_account.bookmarks
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_bookmarks_url pagination_params(max_id: pagination_max_id) if records_continue?
end
@ -43,12 +39,8 @@ class Api::V1::BookmarksController < Api::BaseController
api_v1_bookmarks_url pagination_params(min_id: pagination_since_id) unless results.empty?
end
def pagination_max_id
results.last.id
end
def pagination_since_id
results.first.id
def pagination_collection
results
end
def records_continue?

View file

@ -53,10 +53,6 @@ class Api::V1::ConversationsController < Api::BaseController
.to_a_paginated_by_id(limit_param(LIMIT), params_slice(:max_id, :since_id, :min_id))
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_conversations_url pagination_params(max_id: pagination_max_id) if records_continue?
end

View file

@ -29,10 +29,6 @@ class Api::V1::Crypto::EncryptedMessagesController < Api::BaseController
@encrypted_messages = @current_device.encrypted_messages.to_a_paginated_by_id(limit_param(LIMIT), params_slice(:max_id, :since_id, :min_id))
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_crypto_encrypted_messages_url pagination_params(max_id: pagination_max_id) if records_continue?
end
@ -41,12 +37,8 @@ class Api::V1::Crypto::EncryptedMessagesController < Api::BaseController
api_v1_crypto_encrypted_messages_url pagination_params(min_id: pagination_since_id) unless @encrypted_messages.empty?
end
def pagination_max_id
@encrypted_messages.last.id
end
def pagination_since_id
@encrypted_messages.first.id
def pagination_collection
@encrypted_messages
end
def records_continue?

View file

@ -38,10 +38,6 @@ class Api::V1::DomainBlocksController < Api::BaseController
current_account.domain_blocks
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_domain_blocks_url pagination_params(max_id: pagination_max_id) if records_continue?
end
@ -50,12 +46,8 @@ class Api::V1::DomainBlocksController < Api::BaseController
api_v1_domain_blocks_url pagination_params(since_id: pagination_since_id) unless @blocks.empty?
end
def pagination_max_id
@blocks.last.id
end
def pagination_since_id
@blocks.first.id
def pagination_collection
@blocks
end
def records_continue?

View file

@ -28,10 +28,6 @@ class Api::V1::EndorsementsController < Api::BaseController
current_account.endorsed_accounts.includes(:account_stat, :user).without_suspended
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
return if unlimited?
@ -44,12 +40,8 @@ class Api::V1::EndorsementsController < Api::BaseController
api_v1_endorsements_url pagination_params(since_id: pagination_since_id) unless @accounts.empty?
end
def pagination_max_id
@accounts.last.id
end
def pagination_since_id
@accounts.first.id
def pagination_collection
@accounts
end
def records_continue?

View file

@ -31,10 +31,6 @@ class Api::V1::FavouritesController < Api::BaseController
current_account.favourites
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_favourites_url pagination_params(max_id: pagination_max_id) if records_continue?
end
@ -43,12 +39,8 @@ class Api::V1::FavouritesController < Api::BaseController
api_v1_favourites_url pagination_params(min_id: pagination_since_id) unless results.empty?
end
def pagination_max_id
results.last.id
end
def pagination_since_id
results.first.id
def pagination_collection
results
end
def records_continue?

View file

@ -48,10 +48,6 @@ class Api::V1::FollowRequestsController < Api::BaseController
)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_follow_requests_url pagination_params(max_id: pagination_max_id) if records_continue?
end

View file

@ -22,10 +22,6 @@ class Api::V1::FollowedTagsController < Api::BaseController
)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_followed_tags_url pagination_params(max_id: pagination_max_id) if records_continue?
end
@ -34,12 +30,8 @@ class Api::V1::FollowedTagsController < Api::BaseController
api_v1_followed_tags_url pagination_params(since_id: pagination_since_id) unless @results.empty?
end
def pagination_max_id
@results.last.id
end
def pagination_since_id
@results.first.id
def pagination_collection
@results
end
def records_continue?

View file

@ -55,10 +55,6 @@ class Api::V1::Lists::AccountsController < Api::BaseController
params.permit(account_ids: [])
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
return if unlimited?
@ -71,12 +67,8 @@ class Api::V1::Lists::AccountsController < Api::BaseController
api_v1_list_accounts_url pagination_params(since_id: pagination_since_id) unless @accounts.empty?
end
def pagination_max_id
@accounts.last.id
end
def pagination_since_id
@accounts.first.id
def pagination_collection
@accounts
end
def records_continue?

View file

@ -28,10 +28,6 @@ class Api::V1::MutesController < Api::BaseController
)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_mutes_url pagination_params(max_id: pagination_max_id) if records_continue?
end
@ -40,12 +36,8 @@ class Api::V1::MutesController < Api::BaseController
api_v1_mutes_url pagination_params(since_id: pagination_since_id) unless paginated_mutes.empty?
end
def pagination_max_id
paginated_mutes.last.id
end
def pagination_since_id
paginated_mutes.first.id
def pagination_collection
paginated_mutes
end
def records_continue?

View file

@ -0,0 +1,37 @@
# frozen_string_literal: true
class Api::V1::Notifications::PoliciesController < Api::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:notifications' }, only: :show
before_action -> { doorkeeper_authorize! :write, :'write:notifications' }, only: :update
before_action :require_user!
before_action :set_policy
def show
render json: @policy, serializer: REST::NotificationPolicySerializer
end
def update
@policy.update!(resource_params)
render json: @policy, serializer: REST::NotificationPolicySerializer
end
private
def set_policy
@policy = NotificationPolicy.find_or_initialize_by(account: current_account)
with_read_replica do
@policy.summarize!
end
end
def resource_params
params.permit(
:filter_not_following,
:filter_not_followers,
:filter_new_accounts,
:filter_private_mentions
)
end
end

View file

@ -0,0 +1,75 @@
# frozen_string_literal: true
class Api::V1::Notifications::RequestsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:notifications' }, only: :index
before_action -> { doorkeeper_authorize! :write, :'write:notifications' }, except: :index
before_action :require_user!
before_action :set_request, except: :index
after_action :insert_pagination_headers, only: :index
def index
with_read_replica do
@requests = load_requests
@relationships = relationships
end
render json: @requests, each_serializer: REST::NotificationRequestSerializer, relationships: @relationships
end
def show
render json: @request, serializer: REST::NotificationRequestSerializer
end
def accept
AcceptNotificationRequestService.new.call(@request)
render_empty
end
def dismiss
@request.update!(dismissed: true)
render_empty
end
private
def load_requests
requests = NotificationRequest.where(account: current_account).where(dismissed: truthy_param?(:dismissed) || false).includes(:last_status, from_account: [:account_stat, :user]).to_a_paginated_by_id(
limit_param(DEFAULT_ACCOUNTS_LIMIT),
params_slice(:max_id, :since_id, :min_id)
)
NotificationRequest.preload_cache_collection(requests) do |statuses|
cache_collection(statuses, Status)
end
end
def relationships
StatusRelationshipsPresenter.new(@requests.map(&:last_status), current_user&.account_id)
end
def set_request
@request = NotificationRequest.where(account: current_account).find(params[:id])
end
def next_path
api_v1_notifications_requests_url pagination_params(max_id: pagination_max_id) unless @requests.empty?
end
def prev_path
api_v1_notifications_requests_url pagination_params(min_id: pagination_since_id) unless @requests.empty?
end
def pagination_max_id
@requests.last.id
end
def pagination_since_id
@requests.first.id
end
def pagination_params(core_params)
params.slice(:dismissed).permit(:dismissed).merge(core_params)
end
end

View file

@ -58,7 +58,8 @@ class Api::V1::NotificationsController < Api::BaseController
current_account.notifications.without_suspended.browserable(
types: Array(browserable_params[:types]),
exclude_types: Array(browserable_params[:exclude_types]),
from_account_id: browserable_params[:account_id]
from_account_id: browserable_params[:account_id],
include_filtered: truthy_param?(:include_filtered)
)
end
@ -66,10 +67,6 @@ class Api::V1::NotificationsController < Api::BaseController
@notifications.reject { |notification| notification.target_status.nil? }.map(&:target_status)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_notifications_url pagination_params(max_id: pagination_max_id) unless @notifications.empty?
end
@ -78,19 +75,15 @@ class Api::V1::NotificationsController < Api::BaseController
api_v1_notifications_url pagination_params(min_id: pagination_since_id) unless @notifications.empty?
end
def pagination_max_id
@notifications.last.id
end
def pagination_since_id
@notifications.first.id
def pagination_collection
@notifications
end
def browserable_params
params.permit(:account_id, types: [], exclude_types: [])
params.permit(:account_id, :include_filtered, types: [], exclude_types: [])
end
def pagination_params(core_params)
params.slice(:limit, :account_id, :types, :exclude_types).permit(:limit, :account_id, types: [], exclude_types: []).merge(core_params)
params.slice(:limit, :account_id, :types, :exclude_types, :include_filtered).permit(:limit, :account_id, :include_filtered, types: [], exclude_types: []).merge(core_params)
end
end

View file

@ -47,10 +47,6 @@ class Api::V1::ScheduledStatusesController < Api::BaseController
params.slice(:limit).permit(:limit).merge(core_params)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_scheduled_statuses_url pagination_params(max_id: pagination_max_id) if records_continue?
end
@ -63,11 +59,7 @@ class Api::V1::ScheduledStatusesController < Api::BaseController
@statuses.size == limit_param(DEFAULT_STATUSES_LIMIT)
end
def pagination_max_id
@statuses.last.id
end
def pagination_since_id
@statuses.first.id
def pagination_collection
@statuses
end
end

View file

@ -34,10 +34,6 @@ class Api::V1::Statuses::FavouritedByAccountsController < Api::V1::Statuses::Bas
)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_status_favourited_by_index_url pagination_params(max_id: pagination_max_id) if records_continue?
end

View file

@ -30,10 +30,6 @@ class Api::V1::Statuses::RebloggedByAccountsController < Api::V1::Statuses::Base
)
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def next_path
api_v1_status_reblogged_by_index_url pagination_params(max_id: pagination_max_id) if records_continue?
end

View file

@ -5,16 +5,8 @@ class Api::V1::Timelines::BaseController < Api::BaseController
private
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def pagination_max_id
@statuses.last.id
end
def pagination_since_id
@statuses.first.id
def pagination_collection
@statuses
end
def next_path_params

View file

@ -34,10 +34,6 @@ class Api::V1::Trends::LinksController < Api::BaseController
scope
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def pagination_params(core_params)
params.slice(:limit).permit(:limit).merge(core_params)
end

View file

@ -32,10 +32,6 @@ class Api::V1::Trends::StatusesController < Api::BaseController
scope
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def pagination_params(core_params)
params.slice(:limit).permit(:limit).merge(core_params)
end

View file

@ -30,10 +30,6 @@ class Api::V1::Trends::TagsController < Api::BaseController
Trends.tags.query.allowed
end
def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end
def pagination_params(core_params)
params.slice(:limit).permit(:limit).merge(core_params)
end

View file

@ -131,7 +131,7 @@ class ApplicationController < ActionController::Base
end
def single_user_mode?
@single_user_mode ||= Rails.configuration.x.single_user_mode && Account.where('id > 0').exists?
@single_user_mode ||= Rails.configuration.x.single_user_mode && Account.without_internal.exists?
end
def use_seamless_external_login?
@ -180,7 +180,7 @@ class ApplicationController < ActionController::Base
use_pack 'error'
render 'errors/self_destruct', layout: 'auth', status: 410, formats: [:html]
end
format.json { render json: { error: Rack::Utils::HTTP_STATUS_CODES[410] }, status: code }
format.json { render json: { error: Rack::Utils::HTTP_STATUS_CODES[410] }, status: 410 }
end
end

View file

@ -0,0 +1,52 @@
# frozen_string_literal: true
module Api::ErrorHandling
extend ActiveSupport::Concern
included do
rescue_from ActiveRecord::RecordInvalid, Mastodon::ValidationError do |e|
render json: { error: e.to_s }, status: 422
end
rescue_from ActiveRecord::RecordNotUnique do
render json: { error: 'Duplicate record' }, status: 422
end
rescue_from Date::Error do
render json: { error: 'Invalid date supplied' }, status: 422
end
rescue_from ActiveRecord::RecordNotFound do
render json: { error: 'Record not found' }, status: 404
end
rescue_from HTTP::Error, Mastodon::UnexpectedResponseError do
render json: { error: 'Remote data could not be fetched' }, status: 503
end
rescue_from OpenSSL::SSL::SSLError do
render json: { error: 'Remote SSL certificate could not be verified' }, status: 503
end
rescue_from Mastodon::NotPermittedError do
render json: { error: 'This action is not allowed' }, status: 403
end
rescue_from Seahorse::Client::NetworkingError do |e|
Rails.logger.warn "Storage server error: #{e}"
render json: { error: 'There was a temporary problem serving your request, please try again' }, status: 503
end
rescue_from Mastodon::RaceConditionError, Stoplight::Error::RedLight do
render json: { error: 'There was a temporary problem serving your request, please try again' }, status: 503
end
rescue_from Mastodon::RateLimitExceededError do
render json: { error: I18n.t('errors.429') }, status: 429
end
rescue_from ActionController::ParameterMissing, Mastodon::InvalidParameterError do |e|
render json: { error: e.to_s }, status: 400
end
end
end

View file

@ -6,6 +6,8 @@ class InstanceActorsController < ActivityPub::BaseController
serialization_scope nil
before_action :set_account
skip_before_action :authenticate_user! # From `AccountOwnedConcern`
skip_before_action :require_functional!
skip_before_action :update_user_sign_in
@ -16,6 +18,11 @@ class InstanceActorsController < ActivityPub::BaseController
private
# Skips various `before_action` from `AccountOwnedConcern`
def account_required?
false
end
def set_account
@account = Account.representative
end

View file

@ -28,14 +28,6 @@ module ApplicationHelper
number_to_human(number, **options)
end
def active_nav_class(*paths)
paths.any? { |path| current_page?(path) } ? 'active' : ''
end
def show_landing_strip?
!user_signed_in? && !single_user_mode?
end
def open_registrations?
Setting.registrations_mode == 'open'
end
@ -122,7 +114,7 @@ module ApplicationHelper
end
def check_icon
content_tag(:svg, tag.path('fill-rule': 'evenodd', 'clip-rule': 'evenodd', d: 'M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z'), xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 20 20', fill: 'currentColor')
inline_svg_tag 'check.svg'
end
def visibility_icon(status)
@ -214,7 +206,7 @@ module ApplicationHelper
state_params[:moved_to_account] = current_account.moved_to_account
end
state_params[:owner] = Account.local.without_suspended.where('id > 0').first if single_user_mode?
state_params[:owner] = Account.local.without_suspended.without_internal.first if single_user_mode?
json = ActiveModelSerializers::SerializableResource.new(InitialStatePresenter.new(state_params), serializer: InitialStateSerializer).to_json
# rubocop:disable Rails/OutputSafety

View file

@ -21,15 +21,4 @@ module BrandingHelper
def render_logo
image_pack_tag('logo.svg', alt: 'Mastodon', class: 'logo logo--icon')
end
def render_symbol(version = :icon)
path = case version
when :icon
'logo-symbol-icon.svg'
when :wordmark
'logo-symbol-wordmark.svg'
end
render(file: Rails.root.join('app', 'javascript', 'images', path)).html_safe # rubocop:disable Rails/OutputSafety
end
end

View file

@ -25,12 +25,21 @@ module ContextHelper
memorial: { 'toot' => 'http://joinmastodon.org/ns#', 'memorial' => 'toot:memorial' },
voters_count: { 'toot' => 'http://joinmastodon.org/ns#', 'votersCount' => 'toot:votersCount' },
olm: {
'toot' => 'http://joinmastodon.org/ns#', 'Device' => 'toot:Device', 'Ed25519Signature' => 'toot:Ed25519Signature', 'Ed25519Key' => 'toot:Ed25519Key', 'Curve25519Key' => 'toot:Curve25519Key', 'EncryptedMessage' => 'toot:EncryptedMessage', 'publicKeyBase64' => 'toot:publicKeyBase64', 'deviceId' => 'toot:deviceId',
'toot' => 'http://joinmastodon.org/ns#',
'Device' => 'toot:Device',
'Ed25519Signature' => 'toot:Ed25519Signature',
'Ed25519Key' => 'toot:Ed25519Key',
'Curve25519Key' => 'toot:Curve25519Key',
'EncryptedMessage' => 'toot:EncryptedMessage',
'publicKeyBase64' => 'toot:publicKeyBase64',
'deviceId' => 'toot:deviceId',
'claim' => { '@type' => '@id', '@id' => 'toot:claim' },
'fingerprintKey' => { '@type' => '@id', '@id' => 'toot:fingerprintKey' },
'identityKey' => { '@type' => '@id', '@id' => 'toot:identityKey' },
'devices' => { '@type' => '@id', '@id' => 'toot:devices' },
'messageFranking' => 'toot:messageFranking', 'messageType' => 'toot:messageType', 'cipherText' => 'toot:cipherText'
'messageFranking' => 'toot:messageFranking',
'messageType' => 'toot:messageType',
'cipherText' => 'toot:cipherText',
},
suspended: { 'toot' => 'http://joinmastodon.org/ns#', 'suspended' => 'toot:suspended' },
}.freeze

View file

@ -109,6 +109,7 @@ module LanguagesHelper
mn: ['Mongolian', 'Монгол хэл'].freeze,
mr: ['Marathi', 'मराठी'].freeze,
ms: ['Malay', 'Bahasa Melayu'].freeze,
'ms-Arab': ['Jawi Malay', 'بهاس ملايو'].freeze,
mt: ['Maltese', 'Malti'].freeze,
my: ['Burmese', 'ဗမာစာ'].freeze,
na: ['Nauru', 'Ekakairũ Naoero'].freeze,
@ -127,7 +128,7 @@ module LanguagesHelper
om: ['Oromo', 'Afaan Oromoo'].freeze,
or: ['Oriya', 'ଓଡ଼ିଆ'].freeze,
os: ['Ossetian', 'ирон æвзаг'].freeze,
pa: ['Panjabi', 'ਪੰਜਾਬੀ'].freeze,
pa: ['Punjabi', 'ਪੰਜਾਬੀ'].freeze,
pi: ['Pāli', 'पाऴि'].freeze,
pl: ['Polish', 'Polski'].freeze,
ps: ['Pashto', 'پښتو'].freeze,
@ -191,15 +192,20 @@ module LanguagesHelper
chr: ['Cherokee', 'ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ'].freeze,
ckb: ['Sorani (Kurdish)', 'سۆرانی'].freeze,
cnr: ['Montenegrin', 'crnogorski'].freeze,
csb: ['Kashubian', 'Kaszëbsczi'].freeze,
jbo: ['Lojban', 'la .lojban.'].freeze,
kab: ['Kabyle', 'Taqbaylit'].freeze,
ldn: ['Láadan', 'Láadan'].freeze,
lfn: ['Lingua Franca Nova', 'lingua franca nova'].freeze,
moh: ['Mohawk', 'Kanienʼkéha'].freeze,
nds: ['Low German', 'Plattdüütsch'].freeze,
pdc: ['Pennsylvania Dutch', 'Pennsilfaani-Deitsch'].freeze,
sco: ['Scots', 'Scots'].freeze,
sma: ['Southern Sami', 'Åarjelsaemien Gïele'].freeze,
smj: ['Lule Sami', 'Julevsámegiella'].freeze,
szl: ['Silesian', 'ślůnsko godka'].freeze,
tok: ['Toki Pona', 'toki pona'].freeze,
vai: ['Vai', 'ꕙꔤ'].freeze,
xal: ['Kalmyk', 'Хальмг келн'].freeze,
zba: ['Balaibalan', 'باليبلن'].freeze,
zgh: ['Standard Moroccan Tamazight', 'ⵜⴰⵎⴰⵣⵉⵖⵜ'].freeze,

View file

@ -4,14 +4,6 @@ module StatusesHelper
EMBEDDED_CONTROLLER = 'statuses'
EMBEDDED_ACTION = 'embed'
def link_to_newer(url)
link_to t('statuses.show_newer'), url, class: 'load-more load-gap'
end
def link_to_older(url)
link_to t('statuses.show_older'), url, class: 'load-more load-gap'
end
def nothing_here(extra_classes = '')
content_tag(:div, class: "nothing-here #{extra_classes}") do
t('accounts.nothing_here')

View file

@ -1,232 +0,0 @@
// This file will be loaded on admin pages, regardless of theme.
import 'packs/public-path';
import Rails from '@rails/ujs';
import ready from '../mastodon/ready';
const setAnnouncementEndsAttributes = (target) => {
const valid = target?.value && target?.validity?.valid;
const element = document.querySelector('input[type="datetime-local"]#announcement_ends_at');
if (valid) {
element.classList.remove('optional');
element.required = true;
element.min = target.value;
} else {
element.classList.add('optional');
element.removeAttribute('required');
element.removeAttribute('min');
}
};
Rails.delegate(document, 'input[type="datetime-local"]#announcement_starts_at', 'change', ({ target }) => {
setAnnouncementEndsAttributes(target);
});
const batchCheckboxClassName = '.batch-checkbox input[type="checkbox"]';
const showSelectAll = () => {
const selectAllMatchingElement = document.querySelector('.batch-table__select-all');
selectAllMatchingElement.classList.add('active');
};
const hideSelectAll = () => {
const selectAllMatchingElement = document.querySelector('.batch-table__select-all');
const hiddenField = document.querySelector('#select_all_matching');
const selectedMsg = document.querySelector('.batch-table__select-all .selected');
const notSelectedMsg = document.querySelector('.batch-table__select-all .not-selected');
selectAllMatchingElement.classList.remove('active');
selectedMsg.classList.remove('active');
notSelectedMsg.classList.add('active');
hiddenField.value = '0';
};
Rails.delegate(document, '#batch_checkbox_all', 'change', ({ target }) => {
const selectAllMatchingElement = document.querySelector('.batch-table__select-all');
[].forEach.call(document.querySelectorAll(batchCheckboxClassName), (content) => {
content.checked = target.checked;
});
if (selectAllMatchingElement) {
if (target.checked) {
showSelectAll();
} else {
hideSelectAll();
}
}
});
Rails.delegate(document, '.batch-table__select-all button', 'click', () => {
const hiddenField = document.querySelector('#select_all_matching');
const active = hiddenField.value === '1';
const selectedMsg = document.querySelector('.batch-table__select-all .selected');
const notSelectedMsg = document.querySelector('.batch-table__select-all .not-selected');
if (active) {
hiddenField.value = '0';
selectedMsg.classList.remove('active');
notSelectedMsg.classList.add('active');
} else {
hiddenField.value = '1';
notSelectedMsg.classList.remove('active');
selectedMsg.classList.add('active');
}
});
Rails.delegate(document, batchCheckboxClassName, 'change', () => {
const checkAllElement = document.querySelector('#batch_checkbox_all');
const selectAllMatchingElement = document.querySelector('.batch-table__select-all');
if (checkAllElement) {
checkAllElement.checked = [].every.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked);
checkAllElement.indeterminate = !checkAllElement.checked && [].some.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked);
if (selectAllMatchingElement) {
if (checkAllElement.checked) {
showSelectAll();
} else {
hideSelectAll();
}
}
}
});
Rails.delegate(document, '.media-spoiler-show-button', 'click', () => {
[].forEach.call(document.querySelectorAll('button.media-spoiler'), (element) => {
element.click();
});
});
Rails.delegate(document, '.media-spoiler-hide-button', 'click', () => {
[].forEach.call(document.querySelectorAll('.spoiler-button.spoiler-button--visible button'), (element) => {
element.click();
});
});
Rails.delegate(document, '.filter-subset--with-select select', 'change', ({ target }) => {
target.form.submit();
});
const onDomainBlockSeverityChange = (target) => {
const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media');
const rejectReportsDiv = document.querySelector('.input.with_label.domain_block_reject_reports');
if (rejectMediaDiv) {
rejectMediaDiv.style.display = (target.value === 'suspend') ? 'none' : 'block';
}
if (rejectReportsDiv) {
rejectReportsDiv.style.display = (target.value === 'suspend') ? 'none' : 'block';
}
};
Rails.delegate(document, '#domain_block_severity', 'change', ({ target }) => onDomainBlockSeverityChange(target));
const onEnableBootstrapTimelineAccountsChange = (target) => {
const bootstrapTimelineAccountsField = document.querySelector('#form_admin_settings_bootstrap_timeline_accounts');
if (bootstrapTimelineAccountsField) {
bootstrapTimelineAccountsField.disabled = !target.checked;
if (target.checked) {
bootstrapTimelineAccountsField.parentElement.classList.remove('disabled');
bootstrapTimelineAccountsField.parentElement.parentElement.classList.remove('disabled');
} else {
bootstrapTimelineAccountsField.parentElement.classList.add('disabled');
bootstrapTimelineAccountsField.parentElement.parentElement.classList.add('disabled');
}
}
};
Rails.delegate(document, '#form_admin_settings_enable_bootstrap_timeline_accounts', 'change', ({ target }) => onEnableBootstrapTimelineAccountsChange(target));
const onChangeRegistrationMode = (target) => {
const enabled = target.value === 'approved';
[].forEach.call(document.querySelectorAll('.form_admin_settings_registrations_mode .warning-hint'), (warning_hint) => {
warning_hint.style.display = target.value === 'open' ? 'inline' : 'none';
});
[].forEach.call(document.querySelectorAll('#form_admin_settings_require_invite_text'), (input) => {
input.disabled = !enabled;
if (enabled) {
let element = input;
do {
element.classList.remove('disabled');
element = element.parentElement;
} while (element && !element.classList.contains('fields-group'));
} else {
let element = input;
do {
element.classList.add('disabled');
element = element.parentElement;
} while (element && !element.classList.contains('fields-group'));
}
});
};
const convertUTCDateTimeToLocal = (value) => {
const date = new Date(value + 'Z');
const twoChars = (x) => (x.toString().padStart(2, '0'));
return `${date.getFullYear()}-${twoChars(date.getMonth()+1)}-${twoChars(date.getDate())}T${twoChars(date.getHours())}:${twoChars(date.getMinutes())}`;
};
const convertLocalDatetimeToUTC = (value) => {
const re = /^([0-9]{4,})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})/;
const match = re.exec(value);
const date = new Date(match[1], match[2] - 1, match[3], match[4], match[5]);
const fullISO8601 = date.toISOString();
return fullISO8601.slice(0, fullISO8601.indexOf('T') + 6);
};
Rails.delegate(document, '#form_admin_settings_registrations_mode', 'change', ({ target }) => onChangeRegistrationMode(target));
ready(() => {
const domainBlockSeverityInput = document.getElementById('domain_block_severity');
if (domainBlockSeverityInput) onDomainBlockSeverityChange(domainBlockSeverityInput);
const enableBootstrapTimelineAccounts = document.getElementById('form_admin_settings_enable_bootstrap_timeline_accounts');
if (enableBootstrapTimelineAccounts) onEnableBootstrapTimelineAccountsChange(enableBootstrapTimelineAccounts);
const registrationMode = document.getElementById('form_admin_settings_registrations_mode');
if (registrationMode) onChangeRegistrationMode(registrationMode);
const checkAllElement = document.querySelector('#batch_checkbox_all');
if (checkAllElement) {
checkAllElement.checked = [].every.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked);
checkAllElement.indeterminate = !checkAllElement.checked && [].some.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked);
}
document.querySelector('a#add-instance-button')?.addEventListener('click', (e) => {
const domain = document.querySelector('input[type="text"]#by_domain')?.value;
if (domain) {
const url = new URL(event.target.href);
url.searchParams.set('_domain', domain);
e.target.href = url;
}
});
[].forEach.call(document.querySelectorAll('input[type="datetime-local"]'), element => {
if (element.value) {
element.value = convertUTCDateTimeToLocal(element.value);
}
if (element.placeholder) {
element.placeholder = convertUTCDateTimeToLocal(element.placeholder);
}
});
Rails.delegate(document, 'form', 'submit', ({ target }) => {
[].forEach.call(target.querySelectorAll('input[type="datetime-local"]'), element => {
if (element.value && element.validity.valid) {
element.value = convertLocalDatetimeToUTC(element.value);
}
});
});
const announcementStartsAt = document.querySelector('input[type="datetime-local"]#announcement_starts_at');
if (announcementStartsAt) {
setAnnouncementEndsAttributes(announcementStartsAt);
}
});

View file

@ -0,0 +1,340 @@
// This file will be loaded on admin pages, regardless of theme.
import 'packs/public-path';
import Rails from '@rails/ujs';
import ready from '../mastodon/ready';
const setAnnouncementEndsAttributes = (target: HTMLInputElement) => {
const valid = target.value && target.validity.valid;
const element = document.querySelector<HTMLInputElement>(
'input[type="datetime-local"]#announcement_ends_at',
);
if (!element) return;
if (valid) {
element.classList.remove('optional');
element.required = true;
element.min = target.value;
} else {
element.classList.add('optional');
element.removeAttribute('required');
element.removeAttribute('min');
}
};
Rails.delegate(
document,
'input[type="datetime-local"]#announcement_starts_at',
'change',
({ target }) => {
if (target instanceof HTMLInputElement)
setAnnouncementEndsAttributes(target);
},
);
const batchCheckboxClassName = '.batch-checkbox input[type="checkbox"]';
const showSelectAll = () => {
const selectAllMatchingElement = document.querySelector(
'.batch-table__select-all',
);
selectAllMatchingElement?.classList.add('active');
};
const hideSelectAll = () => {
const selectAllMatchingElement = document.querySelector(
'.batch-table__select-all',
);
const hiddenField = document.querySelector<HTMLInputElement>(
'input#select_all_matching',
);
const selectedMsg = document.querySelector(
'.batch-table__select-all .selected',
);
const notSelectedMsg = document.querySelector(
'.batch-table__select-all .not-selected',
);
selectAllMatchingElement?.classList.remove('active');
selectedMsg?.classList.remove('active');
notSelectedMsg?.classList.add('active');
if (hiddenField) hiddenField.value = '0';
};
Rails.delegate(document, '#batch_checkbox_all', 'change', ({ target }) => {
if (!(target instanceof HTMLInputElement)) return;
const selectAllMatchingElement = document.querySelector(
'.batch-table__select-all',
);
document
.querySelectorAll<HTMLInputElement>(batchCheckboxClassName)
.forEach((content) => {
content.checked = target.checked;
});
if (selectAllMatchingElement) {
if (target.checked) {
showSelectAll();
} else {
hideSelectAll();
}
}
});
Rails.delegate(document, '.batch-table__select-all button', 'click', () => {
const hiddenField = document.querySelector<HTMLInputElement>(
'#select_all_matching',
);
if (!hiddenField) return;
const active = hiddenField.value === '1';
const selectedMsg = document.querySelector(
'.batch-table__select-all .selected',
);
const notSelectedMsg = document.querySelector(
'.batch-table__select-all .not-selected',
);
if (!selectedMsg || !notSelectedMsg) return;
if (active) {
hiddenField.value = '0';
selectedMsg.classList.remove('active');
notSelectedMsg.classList.add('active');
} else {
hiddenField.value = '1';
notSelectedMsg.classList.remove('active');
selectedMsg.classList.add('active');
}
});
Rails.delegate(document, batchCheckboxClassName, 'change', () => {
const checkAllElement = document.querySelector<HTMLInputElement>(
'input#batch_checkbox_all',
);
const selectAllMatchingElement = document.querySelector(
'.batch-table__select-all',
);
if (checkAllElement) {
const allCheckboxes = Array.from(
document.querySelectorAll<HTMLInputElement>(batchCheckboxClassName),
);
checkAllElement.checked = allCheckboxes.every((content) => content.checked);
checkAllElement.indeterminate =
!checkAllElement.checked &&
allCheckboxes.some((content) => content.checked);
if (selectAllMatchingElement) {
if (checkAllElement.checked) {
showSelectAll();
} else {
hideSelectAll();
}
}
}
});
Rails.delegate(
document,
'.filter-subset--with-select select',
'change',
({ target }) => {
if (target instanceof HTMLSelectElement) target.form?.submit();
},
);
const onDomainBlockSeverityChange = (target: HTMLSelectElement) => {
const rejectMediaDiv = document.querySelector(
'.input.with_label.domain_block_reject_media',
);
const rejectReportsDiv = document.querySelector(
'.input.with_label.domain_block_reject_reports',
);
if (rejectMediaDiv && rejectMediaDiv instanceof HTMLElement) {
rejectMediaDiv.style.display =
target.value === 'suspend' ? 'none' : 'block';
}
if (rejectReportsDiv && rejectReportsDiv instanceof HTMLElement) {
rejectReportsDiv.style.display =
target.value === 'suspend' ? 'none' : 'block';
}
};
Rails.delegate(document, '#domain_block_severity', 'change', ({ target }) => {
if (target instanceof HTMLSelectElement) onDomainBlockSeverityChange(target);
});
const onEnableBootstrapTimelineAccountsChange = (target: HTMLInputElement) => {
const bootstrapTimelineAccountsField =
document.querySelector<HTMLInputElement>(
'#form_admin_settings_bootstrap_timeline_accounts',
);
if (bootstrapTimelineAccountsField) {
bootstrapTimelineAccountsField.disabled = !target.checked;
if (target.checked) {
bootstrapTimelineAccountsField.parentElement?.classList.remove(
'disabled',
);
bootstrapTimelineAccountsField.parentElement?.parentElement?.classList.remove(
'disabled',
);
} else {
bootstrapTimelineAccountsField.parentElement?.classList.add('disabled');
bootstrapTimelineAccountsField.parentElement?.parentElement?.classList.add(
'disabled',
);
}
}
};
Rails.delegate(
document,
'#form_admin_settings_enable_bootstrap_timeline_accounts',
'change',
({ target }) => {
if (target instanceof HTMLInputElement)
onEnableBootstrapTimelineAccountsChange(target);
},
);
const onChangeRegistrationMode = (target: HTMLSelectElement) => {
const enabled = target.value === 'approved';
document
.querySelectorAll<HTMLElement>(
'.form_admin_settings_registrations_mode .warning-hint',
)
.forEach((warning_hint) => {
warning_hint.style.display = target.value === 'open' ? 'inline' : 'none';
});
document
.querySelectorAll<HTMLInputElement>(
'input#form_admin_settings_require_invite_text',
)
.forEach((input) => {
input.disabled = !enabled;
if (enabled) {
let element: HTMLElement | null = input;
do {
element.classList.remove('disabled');
element = element.parentElement;
} while (element && !element.classList.contains('fields-group'));
} else {
let element: HTMLElement | null = input;
do {
element.classList.add('disabled');
element = element.parentElement;
} while (element && !element.classList.contains('fields-group'));
}
});
};
const convertUTCDateTimeToLocal = (value: string) => {
const date = new Date(value + 'Z');
const twoChars = (x: number) => x.toString().padStart(2, '0');
return `${date.getFullYear()}-${twoChars(date.getMonth() + 1)}-${twoChars(date.getDate())}T${twoChars(date.getHours())}:${twoChars(date.getMinutes())}`;
};
function convertLocalDatetimeToUTC(value: string) {
const date = new Date(value);
const fullISO8601 = date.toISOString();
return fullISO8601.slice(0, fullISO8601.indexOf('T') + 6);
}
Rails.delegate(
document,
'#form_admin_settings_registrations_mode',
'change',
({ target }) => {
if (target instanceof HTMLSelectElement) onChangeRegistrationMode(target);
},
);
ready(() => {
const domainBlockSeveritySelect = document.querySelector<HTMLSelectElement>(
'select#domain_block_severity',
);
if (domainBlockSeveritySelect)
onDomainBlockSeverityChange(domainBlockSeveritySelect);
const enableBootstrapTimelineAccounts =
document.querySelector<HTMLInputElement>(
'input#form_admin_settings_enable_bootstrap_timeline_accounts',
);
if (enableBootstrapTimelineAccounts)
onEnableBootstrapTimelineAccountsChange(enableBootstrapTimelineAccounts);
const registrationMode = document.querySelector<HTMLSelectElement>(
'select#form_admin_settings_registrations_mode',
);
if (registrationMode) onChangeRegistrationMode(registrationMode);
const checkAllElement = document.querySelector<HTMLInputElement>(
'input#batch_checkbox_all',
);
if (checkAllElement) {
const allCheckboxes = Array.from(
document.querySelectorAll<HTMLInputElement>(batchCheckboxClassName),
);
checkAllElement.checked = allCheckboxes.every((content) => content.checked);
checkAllElement.indeterminate =
!checkAllElement.checked &&
allCheckboxes.some((content) => content.checked);
}
document
.querySelector('a#add-instance-button')
?.addEventListener('click', (e) => {
const domain = document.querySelector<HTMLInputElement>(
'input[type="text"]#by_domain',
)?.value;
if (domain && e.target instanceof HTMLAnchorElement) {
const url = new URL(e.target.href);
url.searchParams.set('_domain', domain);
e.target.href = url.toString();
}
});
document
.querySelectorAll<HTMLInputElement>('input[type="datetime-local"]')
.forEach((element) => {
if (element.value) {
element.value = convertUTCDateTimeToLocal(element.value);
}
if (element.placeholder) {
element.placeholder = convertUTCDateTimeToLocal(element.placeholder);
}
});
Rails.delegate(document, 'form', 'submit', ({ target }) => {
if (target instanceof HTMLFormElement)
target
.querySelectorAll<HTMLInputElement>('input[type="datetime-local"]')
.forEach((element) => {
if (element.value && element.validity.valid) {
element.value = convertLocalDatetimeToUTC(element.value);
}
});
});
const announcementStartsAt = document.querySelector<HTMLInputElement>(
'input[type="datetime-local"]#announcement_starts_at',
);
if (announcementStartsAt) {
setAnnouncementEndsAttributes(announcementStartsAt);
}
}).catch((reason) => {
throw reason;
});

View file

@ -1,25 +0,0 @@
// This file will be loaded on embed pages, regardless of theme.
import 'packs/public-path';
window.addEventListener('message', e => {
const data = e.data || {};
if (!window.parent || data.type !== 'setHeight') {
return;
}
function setEmbedHeight () {
window.parent.postMessage({
type: 'setHeight',
id: data.id,
height: document.getElementsByTagName('html')[0].scrollHeight,
}, '*');
}
if (['interactive', 'complete'].includes(document.readyState)) {
setEmbedHeight();
} else {
document.addEventListener('DOMContentLoaded', setEmbedHeight);
}
});

View file

@ -0,0 +1,41 @@
// This file will be loaded on embed pages, regardless of theme.
import 'packs/public-path';
import ready from '../mastodon/ready';
interface SetHeightMessage {
type: 'setHeight';
id: string;
height: number;
}
function isSetHeightMessage(data: unknown): data is SetHeightMessage {
if (
data &&
typeof data === 'object' &&
'type' in data &&
data.type === 'setHeight'
)
return true;
else return false;
}
window.addEventListener('message', (e) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- typings are not correct, it can be null in very rare cases
if (!e.data || !isSetHeightMessage(e.data) || !window.parent) return;
const data = e.data;
ready(() => {
window.parent.postMessage(
{
type: 'setHeight',
id: data.id,
height: document.getElementsByTagName('html')[0].scrollHeight,
},
'*',
);
}).catch((e) => {
console.error('Error in setHeightMessage postMessage', e);
});
});

View file

@ -1,44 +0,0 @@
// This file will be loaded on settings pages, regardless of theme.
import 'packs/public-path';
import Rails from '@rails/ujs';
Rails.delegate(document, '#edit_profile input[type=file]', 'change', ({ target }) => {
const avatar = document.getElementById(target.id + '-preview');
const [file] = target.files || [];
const url = file ? URL.createObjectURL(file) : avatar.dataset.originalSrc;
avatar.src = url;
});
Rails.delegate(document, '.input-copy input', 'click', ({ target }) => {
target.focus();
target.select();
target.setSelectionRange(0, target.value.length);
});
Rails.delegate(document, '.input-copy button', 'click', ({ target }) => {
const input = target.parentNode.querySelector('.input-copy__wrapper input');
const oldReadOnly = input.readonly;
input.readonly = false;
input.focus();
input.select();
input.setSelectionRange(0, input.value.length);
try {
if (document.execCommand('copy')) {
input.blur();
target.parentNode.classList.add('copied');
setTimeout(() => {
target.parentNode.classList.remove('copied');
}, 700);
}
} catch (err) {
console.error(err);
}
input.readonly = oldReadOnly;
});

View file

@ -0,0 +1,70 @@
// This file will be loaded on settings pages, regardless of theme.
import 'packs/public-path';
import Rails from '@rails/ujs';
Rails.delegate(
document,
'#edit_profile input[type=file]',
'change',
({ target }) => {
if (!(target instanceof HTMLInputElement)) return;
const avatar = document.querySelector<HTMLImageElement>(
`img#${target.id}-preview`,
);
if (!avatar) return;
let file: File | undefined;
if (target.files) file = target.files[0];
const url = file ? URL.createObjectURL(file) : avatar.dataset.originalSrc;
if (url) avatar.src = url;
},
);
Rails.delegate(document, '.input-copy input', 'click', ({ target }) => {
if (!(target instanceof HTMLInputElement)) return;
target.focus();
target.select();
target.setSelectionRange(0, target.value.length);
});
Rails.delegate(document, '.input-copy button', 'click', ({ target }) => {
if (!(target instanceof HTMLButtonElement)) return;
const input = target.parentNode?.querySelector<HTMLInputElement>(
'.input-copy__wrapper input',
);
if (!input) return;
const oldReadOnly = input.readOnly;
input.readOnly = false;
input.focus();
input.select();
input.setSelectionRange(0, input.value.length);
try {
if (document.execCommand('copy')) {
input.blur();
const parent = target.parentElement;
if (!parent) return;
parent.classList.add('copied');
setTimeout(() => {
parent.classList.remove('copied');
}, 700);
}
} catch (err) {
console.error(err);
}
input.readOnly = oldReadOnly;
});

View file

@ -2,12 +2,12 @@
# theme.
pack:
about:
admin: admin.js
admin: admin.ts
auth: auth.js
common:
filename: common.js
stylesheet: true
embed: embed.js
embed: embed.ts
error:
home:
inert:
@ -18,7 +18,7 @@ pack:
stylesheet: true
modal:
public:
settings: settings.js
settings: settings.ts
sign_up:
share:
remote_interaction_helper: remote_interaction_helper.ts

View file

@ -66,11 +66,9 @@ export const FOLLOW_REQUESTS_EXPAND_SUCCESS = 'FOLLOW_REQUESTS_EXPAND_SUCCESS';
export const FOLLOW_REQUESTS_EXPAND_FAIL = 'FOLLOW_REQUESTS_EXPAND_FAIL';
export const FOLLOW_REQUEST_AUTHORIZE_REQUEST = 'FOLLOW_REQUEST_AUTHORIZE_REQUEST';
export const FOLLOW_REQUEST_AUTHORIZE_SUCCESS = 'FOLLOW_REQUEST_AUTHORIZE_SUCCESS';
export const FOLLOW_REQUEST_AUTHORIZE_FAIL = 'FOLLOW_REQUEST_AUTHORIZE_FAIL';
export const FOLLOW_REQUEST_REJECT_REQUEST = 'FOLLOW_REQUEST_REJECT_REQUEST';
export const FOLLOW_REQUEST_REJECT_SUCCESS = 'FOLLOW_REQUEST_REJECT_SUCCESS';
export const FOLLOW_REQUEST_REJECT_FAIL = 'FOLLOW_REQUEST_REJECT_FAIL';
export const PINNED_ACCOUNTS_FETCH_REQUEST = 'PINNED_ACCOUNTS_FETCH_REQUEST';
@ -93,11 +91,6 @@ export * from './accounts_typed';
export function fetchAccount(id) {
return (dispatch, getState) => {
dispatch(fetchRelationships([id]));
if (getState().getIn(['accounts', id], null) !== null) {
return;
}
dispatch(fetchAccountRequest(id));
api(getState).get(`/api/v1/accounts/${id}`).then(response => {

View file

@ -12,8 +12,6 @@ export const BLOCKS_EXPAND_REQUEST = 'BLOCKS_EXPAND_REQUEST';
export const BLOCKS_EXPAND_SUCCESS = 'BLOCKS_EXPAND_SUCCESS';
export const BLOCKS_EXPAND_FAIL = 'BLOCKS_EXPAND_FAIL';
export const BLOCKS_INIT_MODAL = 'BLOCKS_INIT_MODAL';
export function fetchBlocks() {
return (dispatch, getState) => {
dispatch(fetchBlocksRequest());
@ -90,11 +88,12 @@ export function expandBlocksFail(error) {
export function initBlockModal(account) {
return dispatch => {
dispatch({
type: BLOCKS_INIT_MODAL,
account,
});
dispatch(openModal({ modalType: 'BLOCK' }));
dispatch(openModal({
modalType: 'BLOCK',
modalProps: {
accountId: account.get('id'),
acct: account.get('acct'),
},
}));
};
}

View file

@ -266,12 +266,14 @@ export function submitCompose(routerHistory, overridePrivacy = null) {
insertIfOnline('direct');
}
dispatch(showAlert({
message: statusId === null ? messages.published : messages.saved,
action: messages.open,
dismissAfter: 10000,
onClick: () => routerHistory.push(`/@${response.data.account.username}/${response.data.id}`),
}));
if (getState().getIn(['local_settings', 'show_published_toast'])) {
dispatch(showAlert({
message: statusId === null ? messages.published : messages.saved,
action: messages.open,
dismissAfter: 10000,
onClick: () => routerHistory.push(`/@${response.data.account.username}/${response.data.id}`),
}));
}
}).catch(function (error) {
dispatch(submitComposeFail(error));
});
@ -820,11 +822,12 @@ export function addPollOption(title) {
};
}
export function changePollOption(index, title) {
export function changePollOption(index, title, maxOptions) {
return {
type: COMPOSE_POLL_OPTION_CHANGE,
index,
title,
maxOptions,
};
}

View file

@ -1,6 +1,8 @@
import api, { getLinks } from '../api';
import { blockDomainSuccess, unblockDomainSuccess } from "./domain_blocks_typed";
import { openModal } from './modal';
export * from "./domain_blocks_typed";
@ -150,3 +152,12 @@ export function expandDomainBlocksFail(error) {
error,
};
}
export const initDomainBlockModal = account => dispatch => dispatch(openModal({
modalType: 'DOMAIN_BLOCK',
modalProps: {
domain: account.get('acct').split('@')[1],
acct: account.get('acct'),
accountId: account.get('id'),
},
}));

View file

@ -12,10 +12,6 @@ export const MUTES_EXPAND_REQUEST = 'MUTES_EXPAND_REQUEST';
export const MUTES_EXPAND_SUCCESS = 'MUTES_EXPAND_SUCCESS';
export const MUTES_EXPAND_FAIL = 'MUTES_EXPAND_FAIL';
export const MUTES_INIT_MODAL = 'MUTES_INIT_MODAL';
export const MUTES_TOGGLE_HIDE_NOTIFICATIONS = 'MUTES_TOGGLE_HIDE_NOTIFICATIONS';
export const MUTES_CHANGE_DURATION = 'MUTES_CHANGE_DURATION';
export function fetchMutes() {
return (dispatch, getState) => {
dispatch(fetchMutesRequest());
@ -92,26 +88,12 @@ export function expandMutesFail(error) {
export function initMuteModal(account) {
return dispatch => {
dispatch({
type: MUTES_INIT_MODAL,
account,
});
dispatch(openModal({ modalType: 'MUTE' }));
};
}
export function toggleHideNotifications() {
return dispatch => {
dispatch({ type: MUTES_TOGGLE_HIDE_NOTIFICATIONS });
};
}
export function changeMuteDuration(duration) {
return dispatch => {
dispatch({
type: MUTES_CHANGE_DURATION,
duration,
});
dispatch(openModal({
modalType: 'MUTE',
modalProps: {
accountId: account.get('id'),
acct: account.get('acct'),
},
}));
};
}

View file

@ -57,6 +57,38 @@ export const NOTIFICATIONS_MARK_AS_READ = 'NOTIFICATIONS_MARK_AS_READ';
export const NOTIFICATIONS_SET_BROWSER_SUPPORT = 'NOTIFICATIONS_SET_BROWSER_SUPPORT';
export const NOTIFICATIONS_SET_BROWSER_PERMISSION = 'NOTIFICATIONS_SET_BROWSER_PERMISSION';
export const NOTIFICATION_POLICY_FETCH_REQUEST = 'NOTIFICATION_POLICY_FETCH_REQUEST';
export const NOTIFICATION_POLICY_FETCH_SUCCESS = 'NOTIFICATION_POLICY_FETCH_SUCCESS';
export const NOTIFICATION_POLICY_FETCH_FAIL = 'NOTIFICATION_POLICY_FETCH_FAIL';
export const NOTIFICATION_REQUESTS_FETCH_REQUEST = 'NOTIFICATION_REQUESTS_FETCH_REQUEST';
export const NOTIFICATION_REQUESTS_FETCH_SUCCESS = 'NOTIFICATION_REQUESTS_FETCH_SUCCESS';
export const NOTIFICATION_REQUESTS_FETCH_FAIL = 'NOTIFICATION_REQUESTS_FETCH_FAIL';
export const NOTIFICATION_REQUESTS_EXPAND_REQUEST = 'NOTIFICATION_REQUESTS_EXPAND_REQUEST';
export const NOTIFICATION_REQUESTS_EXPAND_SUCCESS = 'NOTIFICATION_REQUESTS_EXPAND_SUCCESS';
export const NOTIFICATION_REQUESTS_EXPAND_FAIL = 'NOTIFICATION_REQUESTS_EXPAND_FAIL';
export const NOTIFICATION_REQUEST_FETCH_REQUEST = 'NOTIFICATION_REQUEST_FETCH_REQUEST';
export const NOTIFICATION_REQUEST_FETCH_SUCCESS = 'NOTIFICATION_REQUEST_FETCH_SUCCESS';
export const NOTIFICATION_REQUEST_FETCH_FAIL = 'NOTIFICATION_REQUEST_FETCH_FAIL';
export const NOTIFICATION_REQUEST_ACCEPT_REQUEST = 'NOTIFICATION_REQUEST_ACCEPT_REQUEST';
export const NOTIFICATION_REQUEST_ACCEPT_SUCCESS = 'NOTIFICATION_REQUEST_ACCEPT_SUCCESS';
export const NOTIFICATION_REQUEST_ACCEPT_FAIL = 'NOTIFICATION_REQUEST_ACCEPT_FAIL';
export const NOTIFICATION_REQUEST_DISMISS_REQUEST = 'NOTIFICATION_REQUEST_DISMISS_REQUEST';
export const NOTIFICATION_REQUEST_DISMISS_SUCCESS = 'NOTIFICATION_REQUEST_DISMISS_SUCCESS';
export const NOTIFICATION_REQUEST_DISMISS_FAIL = 'NOTIFICATION_REQUEST_DISMISS_FAIL';
export const NOTIFICATIONS_FOR_REQUEST_FETCH_REQUEST = 'NOTIFICATIONS_FOR_REQUEST_FETCH_REQUEST';
export const NOTIFICATIONS_FOR_REQUEST_FETCH_SUCCESS = 'NOTIFICATIONS_FOR_REQUEST_FETCH_SUCCESS';
export const NOTIFICATIONS_FOR_REQUEST_FETCH_FAIL = 'NOTIFICATIONS_FOR_REQUEST_FETCH_FAIL';
export const NOTIFICATIONS_FOR_REQUEST_EXPAND_REQUEST = 'NOTIFICATIONS_FOR_REQUEST_EXPAND_REQUEST';
export const NOTIFICATIONS_FOR_REQUEST_EXPAND_SUCCESS = 'NOTIFICATIONS_FOR_REQUEST_EXPAND_SUCCESS';
export const NOTIFICATIONS_FOR_REQUEST_EXPAND_FAIL = 'NOTIFICATIONS_FOR_REQUEST_EXPAND_FAIL';
defineMessages({
mention: { id: 'notification.mention', defaultMessage: '{name} mentioned you' },
});
@ -401,3 +433,270 @@ export function setBrowserPermission (value) {
value,
};
}
export const fetchNotificationPolicy = () => (dispatch, getState) => {
dispatch(fetchNotificationPolicyRequest());
api(getState).get('/api/v1/notifications/policy').then(({ data }) => {
dispatch(fetchNotificationPolicySuccess(data));
}).catch(err => {
dispatch(fetchNotificationPolicyFail(err));
});
};
export const fetchNotificationPolicyRequest = () => ({
type: NOTIFICATION_POLICY_FETCH_REQUEST,
});
export const fetchNotificationPolicySuccess = policy => ({
type: NOTIFICATION_POLICY_FETCH_SUCCESS,
policy,
});
export const fetchNotificationPolicyFail = error => ({
type: NOTIFICATION_POLICY_FETCH_FAIL,
error,
});
export const updateNotificationsPolicy = params => (dispatch, getState) => {
dispatch(fetchNotificationPolicyRequest());
api(getState).put('/api/v1/notifications/policy', params).then(({ data }) => {
dispatch(fetchNotificationPolicySuccess(data));
}).catch(err => {
dispatch(fetchNotificationPolicyFail(err));
});
};
export const fetchNotificationRequests = () => (dispatch, getState) => {
const params = {};
if (getState().getIn(['notificationRequests', 'isLoading'])) {
return;
}
if (getState().getIn(['notificationRequests', 'items'])?.size > 0) {
params.since_id = getState().getIn(['notificationRequests', 'items', 0, 'id']);
}
dispatch(fetchNotificationRequestsRequest());
api(getState).get('/api/v1/notifications/requests', { params }).then(response => {
const next = getLinks(response).refs.find(link => link.rel === 'next');
dispatch(importFetchedAccounts(response.data.map(x => x.account)));
dispatch(fetchNotificationRequestsSuccess(response.data, next ? next.uri : null));
}).catch(err => {
dispatch(fetchNotificationRequestsFail(err));
});
};
export const fetchNotificationRequestsRequest = () => ({
type: NOTIFICATION_REQUESTS_FETCH_REQUEST,
});
export const fetchNotificationRequestsSuccess = (requests, next) => ({
type: NOTIFICATION_REQUESTS_FETCH_SUCCESS,
requests,
next,
});
export const fetchNotificationRequestsFail = error => ({
type: NOTIFICATION_REQUESTS_FETCH_FAIL,
error,
});
export const expandNotificationRequests = () => (dispatch, getState) => {
const url = getState().getIn(['notificationRequests', 'next']);
if (!url || getState().getIn(['notificationRequests', 'isLoading'])) {
return;
}
dispatch(expandNotificationRequestsRequest());
api(getState).get(url).then(response => {
const next = getLinks(response).refs.find(link => link.rel === 'next');
dispatch(importFetchedAccounts(response.data.map(x => x.account)));
dispatch(expandNotificationRequestsSuccess(response.data, next?.uri));
}).catch(err => {
dispatch(expandNotificationRequestsFail(err));
});
};
export const expandNotificationRequestsRequest = () => ({
type: NOTIFICATION_REQUESTS_EXPAND_REQUEST,
});
export const expandNotificationRequestsSuccess = (requests, next) => ({
type: NOTIFICATION_REQUESTS_EXPAND_SUCCESS,
requests,
next,
});
export const expandNotificationRequestsFail = error => ({
type: NOTIFICATION_REQUESTS_EXPAND_FAIL,
error,
});
export const fetchNotificationRequest = id => (dispatch, getState) => {
const current = getState().getIn(['notificationRequests', 'current']);
if (current.getIn(['item', 'id']) === id || current.get('isLoading')) {
return;
}
dispatch(fetchNotificationRequestRequest(id));
api(getState).get(`/api/v1/notifications/requests/${id}`).then(({ data }) => {
dispatch(fetchNotificationRequestSuccess(data));
}).catch(err => {
dispatch(fetchNotificationRequestFail(id, err));
});
};
export const fetchNotificationRequestRequest = id => ({
type: NOTIFICATION_REQUEST_FETCH_REQUEST,
id,
});
export const fetchNotificationRequestSuccess = request => ({
type: NOTIFICATION_REQUEST_FETCH_SUCCESS,
request,
});
export const fetchNotificationRequestFail = (id, error) => ({
type: NOTIFICATION_REQUEST_FETCH_FAIL,
id,
error,
});
export const acceptNotificationRequest = id => (dispatch, getState) => {
dispatch(acceptNotificationRequestRequest(id));
api(getState).post(`/api/v1/notifications/requests/${id}/accept`).then(() => {
dispatch(acceptNotificationRequestSuccess(id));
}).catch(err => {
dispatch(acceptNotificationRequestFail(id, err));
});
};
export const acceptNotificationRequestRequest = id => ({
type: NOTIFICATION_REQUEST_ACCEPT_REQUEST,
id,
});
export const acceptNotificationRequestSuccess = id => ({
type: NOTIFICATION_REQUEST_ACCEPT_SUCCESS,
id,
});
export const acceptNotificationRequestFail = (id, error) => ({
type: NOTIFICATION_REQUEST_ACCEPT_FAIL,
id,
error,
});
export const dismissNotificationRequest = id => (dispatch, getState) => {
dispatch(dismissNotificationRequestRequest(id));
api(getState).post(`/api/v1/notifications/requests/${id}/dismiss`).then(() =>{
dispatch(dismissNotificationRequestSuccess(id));
}).catch(err => {
dispatch(dismissNotificationRequestFail(id, err));
});
};
export const dismissNotificationRequestRequest = id => ({
type: NOTIFICATION_REQUEST_DISMISS_REQUEST,
id,
});
export const dismissNotificationRequestSuccess = id => ({
type: NOTIFICATION_REQUEST_DISMISS_SUCCESS,
id,
});
export const dismissNotificationRequestFail = (id, error) => ({
type: NOTIFICATION_REQUEST_DISMISS_FAIL,
id,
error,
});
export const fetchNotificationsForRequest = accountId => (dispatch, getState) => {
const current = getState().getIn(['notificationRequests', 'current']);
const params = { account_id: accountId };
if (current.getIn(['item', 'account']) === accountId) {
if (current.getIn(['notifications', 'isLoading'])) {
return;
}
if (current.getIn(['notifications', 'items'])?.size > 0) {
params.since_id = current.getIn(['notifications', 'items', 0, 'id']);
}
}
dispatch(fetchNotificationsForRequestRequest());
api(getState).get('/api/v1/notifications', { params }).then(response => {
const next = getLinks(response).refs.find(link => link.rel === 'next');
dispatch(importFetchedAccounts(response.data.map(item => item.account)));
dispatch(importFetchedStatuses(response.data.map(item => item.status).filter(status => !!status)));
dispatch(importFetchedAccounts(response.data.filter(item => item.report).map(item => item.report.target_account)));
dispatch(fetchNotificationsForRequestSuccess(response.data, next?.uri));
}).catch(err => {
dispatch(fetchNotificationsForRequestFail(err));
});
};
export const fetchNotificationsForRequestRequest = () => ({
type: NOTIFICATIONS_FOR_REQUEST_FETCH_REQUEST,
});
export const fetchNotificationsForRequestSuccess = (notifications, next) => ({
type: NOTIFICATIONS_FOR_REQUEST_FETCH_SUCCESS,
notifications,
next,
});
export const fetchNotificationsForRequestFail = (error) => ({
type: NOTIFICATIONS_FOR_REQUEST_FETCH_FAIL,
error,
});
export const expandNotificationsForRequest = () => (dispatch, getState) => {
const url = getState().getIn(['notificationRequests', 'current', 'notifications', 'next']);
if (!url || getState().getIn(['notificationRequests', 'current', 'notifications', 'isLoading'])) {
return;
}
dispatch(expandNotificationsForRequestRequest());
api(getState).get(url).then(response => {
const next = getLinks(response).refs.find(link => link.rel === 'next');
dispatch(importFetchedAccounts(response.data.map(item => item.account)));
dispatch(importFetchedStatuses(response.data.map(item => item.status).filter(status => !!status)));
dispatch(importFetchedAccounts(response.data.filter(item => item.report).map(item => item.report.target_account)));
dispatch(expandNotificationsForRequestSuccess(response.data, next?.uri));
}).catch(err => {
dispatch(expandNotificationsForRequestFail(err));
});
};
export const expandNotificationsForRequestRequest = () => ({
type: NOTIFICATIONS_FOR_REQUEST_EXPAND_REQUEST,
});
export const expandNotificationsForRequestSuccess = (notifications, next) => ({
type: NOTIFICATIONS_FOR_REQUEST_EXPAND_SUCCESS,
notifications,
next,
});
export const expandNotificationsForRequestFail = (error) => ({
type: NOTIFICATIONS_FOR_REQUEST_EXPAND_FAIL,
error,
});

View file

@ -143,11 +143,14 @@ export const showSearch = () => ({
type: SEARCH_SHOW,
});
export const openURL = routerHistory => (dispatch, getState) => {
const value = getState().getIn(['search', 'value']);
export const openURL = (value, history, onFailure) => (dispatch, getState) => {
const signedIn = !!getState().getIn(['meta', 'me']);
if (!signedIn) {
if (onFailure) {
onFailure();
}
return;
}
@ -156,15 +159,21 @@ export const openURL = routerHistory => (dispatch, getState) => {
api(getState).get('/api/v2/search', { params: { q: value, resolve: true } }).then(response => {
if (response.data.accounts?.length > 0) {
dispatch(importFetchedAccounts(response.data.accounts));
routerHistory.push(`/@${response.data.accounts[0].acct}`);
history.push(`/@${response.data.accounts[0].acct}`);
} else if (response.data.statuses?.length > 0) {
dispatch(importFetchedStatuses(response.data.statuses));
routerHistory.push(`/@${response.data.statuses[0].account.acct}/${response.data.statuses[0].id}`);
history.push(`/@${response.data.statuses[0].account.acct}/${response.data.statuses[0].id}`);
} else if (onFailure) {
onFailure();
}
dispatch(fetchSearchSuccess(response.data, value));
}).catch(err => {
dispatch(fetchSearchFail(err));
if (onFailure) {
onFailure();
}
});
};

View file

@ -1,7 +1,7 @@
import api from '../api';
import { ensureComposeIsVisible, setComposeToStatus } from './compose';
import { importFetchedStatus, importFetchedStatuses } from './importer';
import { importFetchedStatus, importFetchedStatuses, importFetchedAccount } from './importer';
import { deleteFromTimelines } from './timelines';
export const STATUS_FETCH_REQUEST = 'STATUS_FETCH_REQUEST';
@ -138,10 +138,10 @@ export function deleteStatus(id, routerHistory, withRedraft = false) {
api(getState).delete(`/api/v1/statuses/${id}`).then(response => {
dispatch(deleteStatusSuccess(id));
dispatch(deleteFromTimelines(id));
dispatch(importFetchedAccount(response.data.account));
if (withRedraft) {
dispatch(redraft(status, response.data.text, response.data.content_type));
ensureComposeIsVisible(getState, routerHistory);
}
}).catch(error => {

View file

@ -10,7 +10,6 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import LinkIcon from '@/material-icons/400-24px/link.svg?react';
import { Icon } from 'flavours/glitch/components/icon';
const filename = url => url.split('/').pop().split('#')[0].split('?')[0];
export default class AttachmentList extends ImmutablePureComponent {

View file

@ -0,0 +1,39 @@
import classNames from 'classnames';
import DoneIcon from '@/material-icons/400-24px/done.svg?react';
import { Icon } from './icon';
interface Props {
value: string;
checked: boolean;
name: string;
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
label: React.ReactNode;
}
export const CheckBox: React.FC<Props> = ({
name,
value,
checked,
onChange,
label,
}) => {
return (
<label className='check-box'>
<input
name={name}
type='checkbox'
value={value}
checked={checked}
onChange={onChange}
/>
<span className={classNames('check-box__input', { checked })}>
{checked && <Icon id='check' icon={DoneIcon} />}
</span>
<span>{label}</span>
</label>
);
};

View file

@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import { PureComponent, useCallback } from 'react';
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
import { FormattedMessage, injectIntl, defineMessages, useIntl } from 'react-intl';
import classNames from 'classnames';
import { withRouter } from 'react-router-dom';
@ -11,12 +11,11 @@ import ArrowBackIcon from '@/material-icons/400-24px/arrow_back.svg?react';
import ChevronLeftIcon from '@/material-icons/400-24px/chevron_left.svg?react';
import ChevronRightIcon from '@/material-icons/400-24px/chevron_right.svg?react';
import CloseIcon from '@/material-icons/400-24px/close.svg?react';
import TuneIcon from '@/material-icons/400-24px/tune.svg?react';
import SettingsIcon from '@/material-icons/400-24px/settings.svg?react';
import { Icon } from 'flavours/glitch/components/icon';
import { ButtonInTabsBar, useColumnsContext } from 'flavours/glitch/features/ui/util/columns_context';
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
import { useAppHistory } from './router';
const messages = defineMessages({
@ -24,10 +23,12 @@ const messages = defineMessages({
hide: { id: 'column_header.hide_settings', defaultMessage: 'Hide settings' },
moveLeft: { id: 'column_header.moveLeft_settings', defaultMessage: 'Move column to the left' },
moveRight: { id: 'column_header.moveRight_settings', defaultMessage: 'Move column to the right' },
back: { id: 'column_back_button.label', defaultMessage: 'Back' },
});
const BackButton = ({ pinned, show }) => {
const BackButton = ({ pinned, show, onlyIcon }) => {
const history = useAppHistory();
const intl = useIntl();
const { multiColumn } = useColumnsContext();
const handleBackClick = useCallback(() => {
@ -40,18 +41,20 @@ const BackButton = ({ pinned, show }) => {
const showButton = history && !pinned && ((multiColumn && history.location?.state?.fromMastodon) || show);
if(!showButton) return null;
return (<button onClick={handleBackClick} className='column-header__back-button'>
<Icon id='chevron-left' icon={ArrowBackIcon} className='column-back-button__icon' />
<FormattedMessage id='column_back_button.label' defaultMessage='Back' />
</button>);
if (!showButton) return null;
return (
<button onClick={handleBackClick} className={classNames('column-header__back-button', { 'compact': onlyIcon })} aria-label={intl.formatMessage(messages.back)}>
<Icon id='chevron-left' icon={ArrowBackIcon} className='column-back-button__icon' />
{!onlyIcon && <FormattedMessage id='column_back_button.label' defaultMessage='Back' />}
</button>
);
};
BackButton.propTypes = {
pinned: PropTypes.bool,
show: PropTypes.bool,
onlyIcon: PropTypes.bool,
};
class ColumnHeader extends PureComponent {
@ -146,27 +149,31 @@ class ColumnHeader extends PureComponent {
}
if (multiColumn && pinned) {
pinButton = <button key='pin-button' className='text-btn column-header__setting-btn' onClick={this.handlePin}><Icon id='times' icon={CloseIcon} /> <FormattedMessage id='column_header.unpin' defaultMessage='Unpin' /></button>;
pinButton = <button className='text-btn column-header__setting-btn' onClick={this.handlePin}><Icon id='times' icon={CloseIcon} /> <FormattedMessage id='column_header.unpin' defaultMessage='Unpin' /></button>;
moveButtons = (
<div key='move-buttons' className='column-header__setting-arrows'>
<div className='column-header__setting-arrows'>
<button title={formatMessage(messages.moveLeft)} aria-label={formatMessage(messages.moveLeft)} className='icon-button column-header__setting-btn' onClick={this.handleMoveLeft}><Icon id='chevron-left' icon={ChevronLeftIcon} /></button>
<button title={formatMessage(messages.moveRight)} aria-label={formatMessage(messages.moveRight)} className='icon-button column-header__setting-btn' onClick={this.handleMoveRight}><Icon id='chevron-right' icon={ChevronRightIcon} /></button>
</div>
);
} else if (multiColumn && this.props.onPin) {
pinButton = <button key='pin-button' className='text-btn column-header__setting-btn' onClick={this.handlePin}><Icon id='plus' icon={AddIcon} /> <FormattedMessage id='column_header.pin' defaultMessage='Pin' /></button>;
pinButton = <button className='text-btn column-header__setting-btn' onClick={this.handlePin}><Icon id='plus' icon={AddIcon} /> <FormattedMessage id='column_header.pin' defaultMessage='Pin' /></button>;
}
backButton = <BackButton pinned={pinned} show={showBackButton} />;
backButton = <BackButton pinned={pinned} show={showBackButton} onlyIcon={!!title} />;
const collapsedContent = [
extraContent,
];
if (multiColumn) {
collapsedContent.push(pinButton);
collapsedContent.push(moveButtons);
collapsedContent.push(
<div key='buttons' className='column-header__advanced-buttons'>
{pinButton}
{moveButtons}
</div>
);
}
if (this.context.identity.signedIn && (children || (multiColumn && this.props.onPin))) {
@ -178,7 +185,7 @@ class ColumnHeader extends PureComponent {
onClick={this.handleToggleClick}
>
<i className='icon-with-badge'>
<Icon id='sliders' icon={TuneIcon} />
<Icon id='sliders' icon={SettingsIcon} />
{collapseIssues && <i className='icon-with-badge__issue-badge' />}
</i>
</button>
@ -191,16 +198,19 @@ class ColumnHeader extends PureComponent {
<div className={wrapperClassName}>
<h1 className={buttonClassName}>
{hasTitle && (
<button onClick={this.handleTitleClick}>
<Icon id={icon} icon={iconComponent} className='column-header__icon' />
{title}
</button>
<>
{showBackButton && backButton}
<button onClick={this.handleTitleClick} className='column-header__title'>
{!showBackButton && <Icon id={icon} icon={iconComponent} className='column-header__icon' />}
{title}
</button>
</>
)}
{!hasTitle && backButton}
{!hasTitle && showBackButton && backButton}
<div className='column-header__buttons'>
{hasTitle && backButton}
{extraButton}
{collapseButton}
</div>

View file

@ -9,7 +9,6 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import { supportsPassiveEvents } from 'detect-passive-events';
import Overlay from 'react-overlays/Overlay';
import CloseIcon from '@/material-icons/400-24px/close.svg?react';
import { CircularProgress } from 'flavours/glitch/components/circular_progress';
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
@ -298,7 +297,7 @@ class Dropdown extends PureComponent {
}) : (
<IconButton
icon={!open ? icon : 'close'}
iconComponent={!open ? iconComponent : CloseIcon}
iconComponent={iconComponent}
title={title}
active={open}
disabled={disabled}

View file

@ -5,10 +5,7 @@ import { FormattedMessage, injectIntl } from 'react-intl';
import { connect } from 'react-redux';
import ArrowDropDownIcon from '@/material-icons/400-24px/arrow_drop_down.svg?react';
import { openModal } from 'flavours/glitch/actions/modal';
import { Icon } from 'flavours/glitch/components/icon';
import InlineAccount from 'flavours/glitch/components/inline_account';
import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp';
@ -68,7 +65,7 @@ class EditedTimestamp extends PureComponent {
return (
<DropdownMenu statusId={statusId} renderItem={this.renderItem} scrollable renderHeader={this.renderHeader} onItemClick={this.handleItemClick}>
<button className='dropdown-menu__text-button'>
<FormattedMessage id='status.edited' defaultMessage='Edited {date}' values={{ date: intl.formatDate(timestamp, { hour12: false, month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }) }} /> <Icon id='caret-down' icon={ArrowDropDownIcon} />
<FormattedMessage id='status.edited' defaultMessage='Edited {date}' values={{ date: <span className='animated-number'>{intl.formatDate(timestamp, { month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' })}</span> }} />
</button>
</DropdownMenu>
);

View file

@ -1,14 +1,12 @@
import logo from '@/images/logo.svg';
export const WordmarkLogo = () => (
export const WordmarkLogo: React.FC = () => (
<svg viewBox='0 0 261 66' className='logo logo--wordmark' role='img'>
<title>Mastodon</title>
<use xlinkHref='#logo-symbol-wordmark' />
</svg>
);
export const SymbolLogo = () => (
export const SymbolLogo: React.FC = () => (
<img src={logo} alt='Mastodon' className='logo logo--icon' />
);
export default WordmarkLogo;

View file

@ -1,6 +1,6 @@
import { FormattedMessage } from 'react-intl';
import illustration from 'flavours/glitch/images/elephant_ui_working.svg';
import illustration from '@/images/elephant_ui_working.svg';
const RegenerationIndicator = () => (
<div className='regeneration-indicator'>

View file

@ -53,7 +53,6 @@ const messages = defineMessages({
});
const dateFormatOptions = {
hour12: false,
year: 'numeric',
month: 'short',
day: '2-digit',
@ -103,7 +102,7 @@ const getUnitDelay = (units: string) => {
};
export const timeAgoString = (
intl: IntlShape,
intl: Pick<IntlShape, 'formatDate' | 'formatMessage'>,
date: Date,
now: number,
year: number,

View file

@ -20,6 +20,7 @@ import Card from '../features/status/components/card';
// to use the progress bar to show download progress
import Bundle from '../features/ui/components/bundle';
import { MediaGallery, Video, Audio } from '../features/ui/util/async-components';
import { SensitiveMediaContext } from '../features/ui/util/sensitive_media_context';
import { displayMedia } from '../initial_state';
import AttachmentList from './attachment_list';
@ -72,6 +73,8 @@ export const defaultMediaVisibility = (status, settings) => {
class Status extends ImmutablePureComponent {
static contextType = SensitiveMediaContext;
static propTypes = {
containerId: PropTypes.string,
id: PropTypes.string,
@ -125,8 +128,7 @@ class Status extends ImmutablePureComponent {
isCollapsed: false,
autoCollapsed: false,
isExpanded: undefined,
showMedia: undefined,
statusId: undefined,
showMedia: defaultMediaVisibility(this.props.status, this.props.settings) && !(this.context?.hideMediaByDefault),
revealBehindCW: undefined,
showCard: false,
forceFilter: undefined,
@ -211,12 +213,6 @@ class Status extends ImmutablePureComponent {
updated = true;
}
if (nextProps.status && nextProps.status.get('id') !== prevState.statusId) {
update.showMedia = defaultMediaVisibility(nextProps.status, nextProps.settings);
update.statusId = nextProps.status.get('id');
updated = true;
}
if (nextProps.settings.getIn(['media', 'reveal_behind_cw']) !== prevState.revealBehindCW) {
update.revealBehindCW = nextProps.settings.getIn(['media', 'reveal_behind_cw']);
if (update.revealBehindCW) {
@ -312,6 +308,18 @@ class Status extends ImmutablePureComponent {
if (snapshot !== null && this.props.updateScrollBottom && this.node.offsetTop < snapshot.top) {
this.props.updateScrollBottom(snapshot.height - snapshot.top);
}
// This will potentially cause a wasteful redraw, but in most cases `Status` components are used
// with a `key` directly depending on their `id`, preventing re-use of the component across
// different IDs.
// But just in case this does change, reset the state on status change.
if (this.props.status?.get('id') !== prevProps.status?.get('id')) {
this.setState({
showMedia: defaultMediaVisibility(this.props.status, this.props.settings) && !(this.context?.hideMediaByDefault),
forceFilter: undefined,
});
}
}
componentWillUnmount() {

View file

@ -351,7 +351,7 @@ class StatusActionBar extends ImmutablePureComponent {
<div className='status__action-bar-spacer' />
<a href={status.get('url')} className='status__relative-time' target='_blank' rel='noopener'>
<RelativeTimestamp timestamp={status.get('created_at')} />{status.get('edited_at') && <abbr title={intl.formatMessage(messages.edited, { date: intl.formatDate(status.get('edited_at'), { hour12: false, year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }) })}> *</abbr>}
<RelativeTimestamp timestamp={status.get('created_at')} />{status.get('edited_at') && <abbr title={intl.formatMessage(messages.edited, { date: intl.formatDate(status.get('edited_at'), { year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }) })}> *</abbr>}
</a>
</div>
);

View file

@ -80,7 +80,7 @@ export default class MediaContainer extends PureComponent {
return (
<IntlProvider>
<>
{[].map.call(components, (component, i) => {
{Array.from(components).map((component, i) => {
const componentName = component.getAttribute('data-component');
const Component = MEDIA_COMPONENTS[componentName];
const { media, card, poll, hashtag, ...props } = JSON.parse(component.getAttribute('data-props'));

View file

@ -10,7 +10,6 @@ import { List as ImmutableList } from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import ChevronRightIcon from '@/material-icons/400-24px/chevron_right.svg?react';
import ExpandMoreIcon from '@/material-icons/400-24px/expand_more.svg?react';
import { fetchServer, fetchExtendedDescription, fetchDomainBlocks } from 'flavours/glitch/actions/server';
@ -171,7 +170,8 @@ class About extends PureComponent {
<ol className='rules-list'>
{server.get('rules').map(rule => (
<li key={rule.get('id')}>
<span className='rules-list__text'>{rule.get('text')}</span>
<div className='rules-list__text'>{rule.get('text')}</div>
{rule.get('hint').length > 0 && (<div className='rules-list__hint'>{rule.get('hint')}</div>)}
</li>
))}
</ol>
@ -189,18 +189,20 @@ class About extends PureComponent {
<>
<p><FormattedMessage id='about.domain_blocks.preamble' defaultMessage='Mastodon generally allows you to view content from and interact with users from any other server in the fediverse. These are the exceptions that have been made on this particular server.' /></p>
<div className='about__domain-blocks'>
{domainBlocks.get('items').map(block => (
<div className='about__domain-blocks__domain' key={block.get('domain')}>
<div className='about__domain-blocks__domain__header'>
<h6><span title={`SHA-256: ${block.get('digest')}`}>{block.get('domain')}</span></h6>
<span className='about__domain-blocks__domain__type' title={intl.formatMessage(severityMessages[block.get('severity')].explanation)}>{intl.formatMessage(severityMessages[block.get('severity')].title)}</span>
</div>
{domainBlocks.get('items').size > 0 && (
<div className='about__domain-blocks'>
{domainBlocks.get('items').map(block => (
<div className='about__domain-blocks__domain' key={block.get('domain')}>
<div className='about__domain-blocks__domain__header'>
<h6><span title={`SHA-256: ${block.get('digest')}`}>{block.get('domain')}</span></h6>
<span className='about__domain-blocks__domain__type' title={intl.formatMessage(severityMessages[block.get('severity')].explanation)}>{intl.formatMessage(severityMessages[block.get('severity')].title)}</span>
</div>
<p>{(block.get('comment') || '').length > 0 ? block.get('comment') : <FormattedMessage id='about.domain_blocks.no_reason_available' defaultMessage='Reason not available' />}</p>
</div>
))}
</div>
<p>{(block.get('comment') || '').length > 0 ? block.get('comment') : <FormattedMessage id='about.domain_blocks.no_reason_available' defaultMessage='Reason not available' />}</p>
</div>
))}
</div>
)}
</>
) : (
<p><FormattedMessage id='about.not_available' defaultMessage='This information has not been made available on this server.' /></p>

View file

@ -0,0 +1,86 @@
import PropTypes from 'prop-types';
import { useState, useRef, useCallback } from 'react';
import { FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import Overlay from 'react-overlays/Overlay';
import AlternateEmailIcon from '@/material-icons/400-24px/alternate_email.svg?react';
import BadgeIcon from '@/material-icons/400-24px/badge.svg?react';
import GlobeIcon from '@/material-icons/400-24px/globe.svg?react';
import { Icon } from 'flavours/glitch/components/icon';
export const DomainPill = ({ domain, username, isSelf }) => {
const [open, setOpen] = useState(false);
const [expanded, setExpanded] = useState(false);
const triggerRef = useRef(null);
const handleClick = useCallback(() => {
setOpen(!open);
}, [open, setOpen]);
const handleExpandClick = useCallback(() => {
setExpanded(!expanded);
}, [expanded, setExpanded]);
return (
<>
<button className={classNames('account__domain-pill', { active: open })} ref={triggerRef} onClick={handleClick}>{domain}</button>
<Overlay show={open} rootClose onHide={handleClick} offset={[5, 5]} target={triggerRef}>
{({ props }) => (
<div {...props} className='account__domain-pill__popout dropdown-animation'>
<div className='account__domain-pill__popout__header'>
<div className='account__domain-pill__popout__header__icon'><Icon icon={BadgeIcon} /></div>
<h3><FormattedMessage id='domain_pill.whats_in_a_handle' defaultMessage="What's in a handle?" /></h3>
</div>
<div className='account__domain-pill__popout__handle'>
<div className='account__domain-pill__popout__handle__label'>{isSelf ? <FormattedMessage id='domain_pill.your_handle' defaultMessage='Your handle:' /> : <FormattedMessage id='domain_pill.their_handle' defaultMessage='Their handle:' />}</div>
<div className='account__domain-pill__popout__handle__handle'>@{username}@{domain}</div>
</div>
<div className='account__domain-pill__popout__parts'>
<div>
<div className='account__domain-pill__popout__parts__icon'><Icon icon={AlternateEmailIcon} /></div>
<div>
<h6><FormattedMessage id='domain_pill.username' defaultMessage='Username' /></h6>
<p>{isSelf ? <FormattedMessage id='domain_pill.your_username' defaultMessage='Your unique identifier on this server. Its possible to find users with the same username on different servers.' /> : <FormattedMessage id='domain_pill.their_username' defaultMessage='Their unique identifier on their server. Its possible to find users with the same username on different servers.' />}</p>
</div>
</div>
<div>
<div className='account__domain-pill__popout__parts__icon'><Icon icon={GlobeIcon} /></div>
<div>
<h6><FormattedMessage id='domain_pill.server' defaultMessage='Server' /></h6>
<p>{isSelf ? <FormattedMessage id='domain_pill.your_server' defaultMessage='Your digital home, where all of your posts live. Dont like this one? Transfer servers at any time and bring your followers, too.' /> : <FormattedMessage id='domain_pill.their_server' defaultMessage='Their digital home, where all of their posts live.' />}</p>
</div>
</div>
</div>
<p>{isSelf ? <FormattedMessage id='domain_pill.who_you_are' defaultMessage='Because your handle says who you are and where you are, people can interact with you across the social web of <button>ActivityPub-powered platforms</button>.' values={{ button: x => <button onClick={handleExpandClick} className='link-button'>{x}</button> }} /> : <FormattedMessage id='domain_pill.who_they_are' defaultMessage='Since handles say who someone is and where they are, you can interact with people across the social web of <button>ActivityPub-powered platforms</button>.' values={{ button: x => <button onClick={handleExpandClick} className='link-button'>{x}</button> }} />}</p>
{expanded && (
<>
<p><FormattedMessage id='domain_pill.activitypub_like_language' defaultMessage='ActivityPub is like the language Mastodon speaks with other social networks.' /></p>
<p><FormattedMessage id='domain_pill.activitypub_lets_connect' defaultMessage='It lets you connect and interact with people not just on Mastodon, but across different social apps too.' /></p>
</>
)}
</div>
)}
</Overlay>
</>
);
};
DomainPill.propTypes = {
username: PropTypes.string.isRequired,
domain: PropTypes.string.isRequired,
isSelf: PropTypes.bool,
};

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