Commit Graph

291 Commits (ef39398b82449440872d899cc5902b8eb7f7c26c)

Author SHA1 Message Date
Matt Jankowski 0b853678a4
Add coverage for `api/v1/peers/search` endpoint and extract controller query to Instance scope ()
Matt Jankowski e72676e83a
Improve `api/v1/markers#create` performance against simultaneous requests ()
Matt Jankowski 7801db7ba4
Spec coverage for custom css endpoint ()
Matt Jankowski 2954279e9c
Remove double subject call in `api/v1/admin/trends/links/links` spec ()
Matt Jankowski 95bd46d32a
Remove double subject call in `api/v1/admin/ip_blocks` spec ()
Matt Jankowski 00341c70ff
Use Sidekiq `fake!` instead of `inline!` in specs ()
Claire 092bb8a27a
Fix Mastodon not correctly processing HTTP Signatures with query strings ()
Claire bd415af9a1
Change streaming API host to not be overridden to localhost in development mode ()
Claire a2624ff739
Convert signature verification specs to request specs ()
Claire 6fed0fcbaa
Remove unneeded settings cleanup from specs ()
Eugen Rochko b5ac61b2c5
Change algorithm of follow recommendations ()
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Matt Jankowski c28976d89e
Handle negative offset param in `api/v2/search` ()
Matt Jankowski 1820bad646
Fix `Performance/StringIdentifierArgument` cop ()
Matt Jankowski adbfd40a1b
Convert `api/v1/directories` controller spec to request spec ()
Matt Jankowski 28e1a7a394
Improve spec coverage for `models/announcement` class ()
Matt Jankowski 0e4233de9d
Controller spec to request spec: `api/v2/suggestions` ()
Matt Jankowski 0c64092500
Controller spec to request spec: `api/v1/accounts/search` ()
Matt Jankowski 16ede59d0a
Controller spec to request spec: `api/v1/featured_tags/suggestions` ()
Matt Jankowski 809506bdd4
Controller spec to request spec: `api/v1/accounts/pins` ()
Matt Jankowski 94cc707ab3
Controller spec to request spec: `api/v1/accounts/notes` ()
Matt Jankowski e544b6df42
Controller spec to request spec: `api/v1/accounts/lookup` ()
Matt Jankowski a968898dc7
Controller spec to request spec: `api/v1/accounts/lists` ()
Matt Jankowski 8f94502e7d
Controller spec to request spec: `api/v1/accounts/identify_proofs` ()
Matt Jankowski 78347d2556
Controller spec to request spec: `api/v1/accounts/familiar_followers` ()
Matt Jankowski 11d2bd9716
Fix intermittent failure from unspecified order in `api/v1/accounts/relationships` spec ()
Matt Jankowski 7e514688b3
Convert `api/v2/search` controller spec to request spec ()
Matt Jankowski 71e5a16eba
Remove triple subject call in `api/v1/lists` spec ()
Matt Jankowski cca19f5fbb
Use the `Admin::ActionLog` fabricator in admin/action_logs spec ()
Matt Jankowski 0530ce5e95
Convert accounts controller spec to request spec ()
Claire 85662a5a57
Change `img-src` and `media-src` CSP directives to not include `https:` ()
Kevin Bongart 7877fcd83c
Deduplicate IDs in relationships and familiar_followers APIs ()
Matt Jankowski 973597c6f1
Consolidate configuration of `Sidekiq::Testing.fake!` setup ()
Matt Jankowski 9742bccbe7
Add coverage for `api/v2/media` endpoint ()
Matt Jankowski 30ee4aaff4
Convert measurement `api/v1/admin/*` controller specs to request specs ()
Matt Jankowski 32e19e3af6
Reduce `.times` usage in request and controller specs ()
Matt Jankowski a6d446e6a7
Add coverage for `remote_interaction_helper` ()
Matt Jankowski 876f5b1d12
Convert `/instances/*` controller specs to request specs ()
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Matt Jankowski 718c95e7af
Convert `api/v1/custom_emojis` controller spec to request spec ()
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Matt Jankowski 17582d36d5
Convert `api/v1/preferences` controller spec to request spec ()
Matt Jankowski 9a01a260a0
Convert `api/v1/scheduled_statuses` controller spec to request spec ()
Matt Jankowski b9fb47aeb1
Convert `api/v1/endorsements` controller spec to request spec ()
Matt Jankowski 09a2db3f6c
Move api/v2/filters spec to correct path location ()
Claire 297839c10c
Rewrite `/api/v1/statuses` tests as request specs ()
Claire 9257737675
Rewrite `/api/v1/accounts` tests as request specs ()
Matt Jankowski 549e8e7baf
Add `email_spec` and speedup/cleanup to `spec/mailers` ()
Matt Jankowski 3f0c1566c3
Reduce expectations for `RSpec/MultipleExpectations` cop in `api/v1/accounts/relationships` spec ()
Matt Jankowski 3de9145613
Move controller specs for `well-known` endpoints to request specs ()
Matt Jankowski 12a5b7391d
Add spec for well known change password endpoint ()
Matt Jankowski d562fb8459
Specs for minimal CSP policy in `Api::` controllers ()
Matt Jankowski 5e2ecc736d
Remove double `subject` in api/v1/accounts/relationships spec ()
Claire 07a4059901
Add support for invite codes in the registration API ()
Claire c451bbe249
Allow viewing and severing relationships with suspended accounts ()
Matt Jankowski 9b7b4d748f
Simplify request cache spec shared examples ()
Claire 23e32a4b30
Fix format-dependent redirects being cached regardless of requested format ()
Matt Jankowski a688a9ed20
Use strings instead of numeric literals and remove `rubocop:disable` in cache spec ()
Matt Jankowski 949f5eb860
Fix `RSpec/MetadataStyle` cop in spec/ ()
Claire bbf46cc418
Fix error and incorrect URLs in `/api/v1/accounts/:id/featured_tags` for remote accounts ()
Daniel M Brasil 26d2a2a0cc
Migrate to request specs in `/api/v1/media` ()
Emelia Smith 7c3fea7275
Feature: Allow token introspection without read scope ()
Daniel M Brasil e0ed0f8c7c
Migrate to request specs in `/api/v1/notifications` ()
Daniel M Brasil cafdaec6cf
Migrate to request specs in `/api/v1/lists/:id/accounts` ()
Daniel M Brasil 8e6116503d
Migrate to request specs in `/api/v1/blocks` ()
Daniel M Brasil d9caa6ed24
Migrate to request specs in `/api/v1/admin/accounts` ()
Daniel M Brasil 82beeb2f7e
Migrate to request specs in `/api/v1/admin/trends/links` ()
Claire 71cfdd7865
Fix duplicate tests ()
Daniel M Brasil 058f73a4f5
Add request specs for `/api/v1/reports` ()
Daniel M Brasil bc6cd27d9e
Migrate to request specs in `/api/v1/followed_tags` ()
Matt Jankowski fd9dea21d0
DB speedup in `API::` controller/request specs ()
Daniel M Brasil ecdb31d479
Migrate to request specs in `/api/v1/favourites` ()
Daniel M Brasil 7664e3b692
Migrate to request specs in `/api/v1/statuses/:status_id/source` ()
Daniel M Brasil 4230d1ee0a
Migrate to request specs in `/api/v1/timelines/tag/:hashtag` ()
Claire 40ba6e119b
Fix Vary headers not being set on some redirects ()
Claire 828eebad48
Add `hide_collections`, `discoverable` and `indexable` attributes to credentials API ()
Robert R George 20666482ef
Added admin api for managing tags ()
Daniel M Brasil f337008819
Fix timeout on invalid set of exclusionary parameters in `/api/v1/timelines/public` ()
Claire 191d302b7f
Refactor `Api::V1::ProfilesController` into two separate controllers ()
Daniel M Brasil d24a87ce4f
Add ability to delete avatar or header picture via the API ()
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Daniel M Brasil 3a4d3e9d4b
Add `GET /api/v1/instance/languages` to REST API ()
Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Emelia Smith e258b4cb64
Refactor: replace whitelist_mode mentions with limited_federation_mode ()
Christian Schmidt ca342d4838
Add List-Unsubscribe email header ()
Daniel M Brasil 812a84ff5f
Migrate to request specs in `/api/v2/filters` ()
Matt Jankowski 50ff3d3342
Coverage for `Auth::OmniauthCallbacks` controller ()
Claire e5f1000ad1
Fix CSP headers being unintendedly wide ()
Christian Schmidt 4c18928a93
Wrong count in response when removing favourite/reblog ()
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Daniel M Brasil 59b38f9ee4
Migrate to request specs in `/api/v1/mutes` ()
Daniel M Brasil 58bfe8c43a
Migrate to request specs in `/api/v1/bookmarks` ()
Daniel M Brasil 5a7c6c6597
Migrate to request specs in `/api/v1/timelines/public` ()
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Daniel M Brasil 19208aa422
Migrate to request specs in `/api/v1/statuses/:status_id/favourite` ()
Daniel M Brasil 6fb4a756ff
Migrate to request specs in `/api/v1/statuses/:status_id/bookmark` ()
Daniel M Brasil 4859958a0c
Migrate to request specs in `/api/v1/polls` ()
Daniel M Brasil 1aea938d3d
Migrate to request specs in `/api/v1/statuses/:status_id/pin` ()
Daniel M Brasil 6cdc8408a9
Migrate to request specs in `/api/v1/emails/confirmations` ()
Daniel M Brasil 8a1aabaac1
Migrate to request specs in `/api/v1/timelines/home` ()
Claire 41f65edb21
Fix embed dropdown menu item for unauthenticated users ()
Claire 94fbac77e7
Fix processing of media files with unusual names ()
Daniel M Brasil 6ac271c2a0
Migrate to request specs in `/api/v1/suggestions` ()
Daniel M Brasil e53eb38a8d
Migrate to request specs in `/api/v1/admin/account_actions` ()
Daniel M Brasil 0a0a1f1495
Migrate to request specs in `/api/v1/tags` ()
Daniel M Brasil b10c05e702
Migrate to request specs in `/api/v1/lists` ()
Daniel M Brasil 24015ef0cc
Migrate to request specs in `/api/v1/domain_blocks` ()
Daniel M Brasil 87aff5aad8
Migrate to request specs in `/api/v1/follow_requests` ()
Daniel M Brasil a5b62e56d0
Migrate to request specs in `/api/v1/apps/verify_credentials` ()
Daniel M Brasil a6407aa662
Migrate to request specs in `/api/v1/apps` ()
Matt Jankowski 4c5f62de99
Extract shared examples from api specs ()
fusagiko / takayamaki b19a695608
migrate test for `GET /api/v1/accounts/{account_id}` to request spec ()
Daniel M Brasil 99216e34e5
Migrate to request specs in `/api/v1/admin/canonical_email_blocks` ()
Daniel M Brasil b4e19f9610
Migrate to request specs in `/api/v1/admin/ip_blocks` ()
Daniel M Brasil 4301d8cbb3
Migrate to request specs in `/api/v1/admin/domain_allows` ()
Daniel M Brasil 841c220c40
Migrate to request specs in `/api/v1/admin/domain_blocks` ()
Daniel M Brasil 0e200d4e2f
Migrate to request specs in `/api/v1/admin/reports` ()
Daniel M Brasil 4aff1d2974
Migrate to request specs in `/api/v1/admin/email_domain_blocks` ()
Matt Jankowski c9f980b268
Add request spec for backups download ()
Daniel M Brasil b473df9a14
Improve test coverage for `/api/v1/featured_tags` ()
Matt Jankowski bdcd8a9e88
Misc spec cleanup ()
Matt Jankowski 97385f27bd
Fix Performance/RedundantEqualityComparisonBlock cop ()
Claire 1eb51bd749
Add request specs for caching behavior ()
Matt Jankowski d00e45a7d3
Fix Rails/I18nLocaleAssignment cop ()
João Pedro Marques 8f6e290c7a
Adds new follower/following routes ()
Claire 276c39361b
Fix anonymous visitors getting a session cookie on first visit ()
Nick Schonning 84cc805cae
Enable Style/FrozenStringLiteralComment for specs ()
Nick Schonning aef0051fd0
Enable Rubocop HTTP status rules ()
Nick Schonning 81ad6c2e39
Autofix Rubocop Style/StringLiterals ()
Eugen Rochko 839f893168
Change public accounts pages to mount the web UI ()
* Change public accounts pages to mount the web UI

* Fix handling of remote usernames in routes

- When logged in, serve web app
- When logged out, redirect to permalink
- Fix `app-body` class not being set sometimes due to name conflict

* Fix missing `multiColumn` prop

* Fix failing test

* Use `discoverable` attribute to control indexing directives

* Fix `<ColumnLoading />` not using `multiColumn`

* Add `noindex` to accounts in REST API

* Change noindex directive to not be rendered by default before a route is mounted

* Add loading indicator for detailed status in web UI

* Fix missing indicator appearing while account is loading in web UI
Eugen Rochko 58d5b28cb0
Remove previous landing page ()
Claire b358229834
Further preparation for Rails 6 ()
* Use ActiveRecord::Result#to_ary instead of deprecated to_hash

They do the same thing, and to_hash has been removed from Rails 6.1

* Explicitly name polymorphic indexes to workaround a bug in Rails 6.1

cf. https://github.com/rails/rails/issues/41693

* Fix incorrect usage of “foreign_key” in migration script

* Use `ActiveModel::Errors#delete` instead of deprecated clear method

* Fix link headers tests on Rails 6.1

Rails 6.1 adds values to the Link header by default, thus it is not a
LinkHeader object anymore. Fix the test to parse the Link header instead
of assuming it is a LinkHeader.
Claire 43eff898a0
Prepare Mastodon for Rails 6 ()
* Fix misuse of foreign_type

* Fix use of removed "add_template_helper"

* Use response.media_type instead of response.content_type in tests

* Fix CSV export controller test on Rails 6

Rails 6 sets a "filename*" field in the Content-Disposition header to
explicitly encode the filename as UTF-8.

This changes checks the first part of the Content-Disposition header so
it matches in both Rails 5 and Rails 6.

* Fix emoji formatting with Rails 6

* Make emoji output more idiomatic and robust

* Switch from redis-rails gem to built-in Rails redis cache storage
Eugen Rochko 510e184216
Fix localization test failing due to order of locale definitions ()
Eugen Rochko 8b9d0a0533
Remove XML version of Webfinger and remove links to Atom feeds ()
Fix 
Eugen Rochko 63c7fe8e48
Refactor controllers for statuses, accounts, and more ()
Eugen Rochko 65fffeac3f
Redesign landing page ()
Yamagishi Kazutoshi d10447c3a8 Use raw status code on have_http_status ()
Eugen Rochko e19eefe219 Redesign the landing page, mount public timeline on it ()
* Redesign the landing page, mount public timeline on it

* Adjust the standalone mounted component to the lacking of router

* Adjust auth layout pages to new design

* Fix tests

* Standalone public timeline polling every 5 seconds

* Remove now obsolete translations

* Add responsive design for new landing page

* Address reviews

* Add floating clouds behind frontpage form

* Use access token from public page when available

* Fix mentions and hashtags links, cursor on status content in standalone mode

* Add footer link to source code

* Fix errors on pages that don't embed the component, use classnames

* Fix tests

* Change anonymous autoPlayGif default to false

* When gif autoplay is disabled, hover to play

* Add option to hide the timeline preview

* Slightly improve alt layout

* Add elephant friend to new frontpage

* Display "back to mastodon" in place of "login" when logged in on frontpage

* Change polling time to 3s
unarist abbdacedc5 Fix locale related specs ()
* Use I18n.locale instead of ":en"
* Reset I18n.locale value after locale changing tests
Yamagishi Kazutoshi 0a0b9a271a Improve RuboCop rules (compatibility to Code Climate) ()
08f8de84eb/Gemfile.lock (L38)
Code Climate is using RuboCop v0.46.0.

Change several rules to maintain compatibility.
Matt Jankowski f9d398e8fb Remove the react-rails gem ()
* Remove react-rails gem

* Fix broken view spec
Matt Jankowski 8bac0350d1 Restful refactor of accounts/ routes ()
* Add routing specs for accounts followers and following actions

* Use more restful route naming for public account follow pages

Moves two actions:
- accounts#followers to accounts/follower_accounts#index
- accounts#following to accounts/following_accounts#index

Adds routing spec to ensure prior URLs are preserved.
Matt Jankowski 21a767dcfa Improve handling of HTTP_ACCEPT for webfinger ()
This change includes:

- Improve the spec coverage for incoming request to the webfinger action
- For requests without an accept header (ie, what a browser might look like),
  return a JSON response.
- For requests with an explicit format of xml or json, return that format.
- For requests using an accept header, return that format.

Also adds failing spec showing webfinger does not return xml, which covers the
issue described in: https://github.com/tootsuite/mastodon/issues/1983
Matt Jankowski f5cd138323 Improve i18n chooser ()
* Add locale spec with failing locale plus region check

* Use a more accurate locale when supplied by browser headers

Previously we were using a matching option which would use the first locale
available which matched the locale portion, even if a region was specified.

This changes to first try to find an exact match, and then fall back to the
region, and then fall back to the  default.

* Clean up default_locale method
Matt Jankowski 137100dcf3 Clean up well-known routes/controllers ()
* Add request spec for host meta route returning xml

* Add routing spec for xrd routes

* Update well-known routes

* Move webfinger and host-meta actions to their own controllers
Matt Jankowski b352a8e5d4 Default to json type for webfinger requests ()
Matt Jankowski 71706f21c2 Ignore implied formats for catch all route requests ()
A request to `/test` would show the custom 404 page, but a request to
`/test.test` would return a 404 with an empty body.

This change ignores the format on incoming catch all route requests, so that the
html 404 page is returned on these requests.