Commit Graph

495 Commits (794781d1219112482e4abbc0a98683a17d170e2b)

Author SHA1 Message Date
Yamagishi Kazutoshi 0a0b9a271a Improve RuboCop rules (compatibility to Code Climate) (#3636)
08f8de84eb/Gemfile.lock (L38)
Code Climate is using RuboCop v0.46.0.

Change several rules to maintain compatibility.
7 years ago
Matt Jankowski 73540ffe6b Clean up for api/base controller (#3629)
* Move ApiController to Api/BaseController

* API controllers inherit from Api::BaseController

* Add coverage for various error cases in api/base controller
7 years ago
unarist 0f1b1d78b1 Use "match_array" only for order independent assertions (#3626) 7 years ago
Matt Jankowski f0634ba876 Coverage improvement and concern extraction for rate limit headers in API controller (#3625)
* Coverage for rate limit headers

* Move rate limit headers methods to concern

* Move throttle check to condition on before_action

* Move match_data variable into method

* Move utc timestamp to separate method

* Move header setting into smaller methods

* specs cleanup
7 years ago
unarist e34c5a3503 Fix 500 errors on searching invalid URLs (#3613) 7 years ago
unarist 004672aa6c Fix tag search order and not to use tsvector (#3611)
* Sort results by the name
* Switch search method to simple `LIKE` matching instead of tsvector/tsquery

Previously we used scores from ts_rank_cd() to sort results, but it didn't work
because the function returns same score for all results. It's not for calculate
similarity of single words. Sometimes this bug even push out exact matching tag
from results.

Additionally, PostgreSQL supports prefix searching with standard btree index.
Using it offers simpler code, but also less index size and some speed.
7 years ago
Yamagishi Kazutoshi 7a7bfa5170 Add quotes ESLint rules (#3602)
* Add quotes ESLint rule

* Add jsx-quotes ESlint rule

* Sort ESLint rules
7 years ago
Matt Jankowski 6201f96b8a Introduce StatusThreadingConcern (#3490)
* Add a StatusFilter class to identify visibility of statuses by accounts

* Extract StatusThreadingConcern from Status

* Clarify purpose of checking for nil account
7 years ago
Daigo 3 Dango 2985d08951 Redirect to streaming_api_base_url (#3579)
* Redirect to streaming_api_base_url

When Rails receives a request to streaming API, it most likely
means that there is another host which is configured to respond
to it. This is to redirect clients to that host if
`STREAMING_API_BASE_URL` is set as another host.

* Use the new Ruby 1.9 hash syntax
7 years ago
Yamagishi Kazutoshi 6a4b224397 Fix randomly fail (regression from #3560) (#3580) 7 years ago
Yamagishi Kazutoshi 6adbd114c1 Skip image length check (regression from #3528) (#3581) 7 years ago
René Klačan 037f96c5ae Don't follow account if it's already followed (#3575)
Closes https://github.com/tootsuite/mastodon/issues/3102
7 years ago
Eugen Rochko f7a30e2fae Added support for configurable reserved usernames (fix of #1382) (#3566)
* Added support for configurable reserved usernames

* Added reserved usernames from mastodon issue 1355

* Fix reserved usernames
7 years ago
Akihiko Odaki (@fn_aki@pawoo.net) defe4f9bc3 Cover WebfingerResource more (#3560) 7 years ago
Akihiko Odaki (@fn_aki@pawoo.net) 42844df966 Spec ScopedSettings (#3559) 7 years ago
Akihiko Odaki (@fn_aki@pawoo.net) e07b57852e Remove some code in TagManager and spec (#3547)
* Do not fall back to StreamEntry if object_type is unavailable in TagManager

Since 6d6a429af8, when Status, the only model
with stream_entry, and StreamEntry got its own logic in uri_for and
url_for, the purpose of the fallbacks to activity_type of StreamEntry
became unclear.

This commit removes the fallbacks. When adding another model with
stream_entry in future, consider to update uri_for and url_for.

* Cover TagManager more
7 years ago
Akihiko Odaki (@fn_aki@pawoo.net) 02a0fd5b64 Spec InlineRablScope (#3542) 7 years ago
Akihiko Odaki (@fn_aki@pawoo.net) 6505a42be0 Spec HashObject (#3544) 7 years ago
Akihiko Odaki (@fn_aki@pawoo.net) e674608d10 A minor change for ProviderDiscovery and spec (#3543)
* Do not default the format in ProviderDiscovery

The format should be determined when discovering, as it is in the current
implementation, and it is a flaw if it is not determined.

* Spec ProviderDiscovery
7 years ago
Akihiko Odaki (@fn_aki@pawoo.net) c7af8cbc90 Remove some arguments of Formatter.instance.format and spec (#3541)
* Remove some arguments of Formatter.instance.format

* Improve spec for Formatter
7 years ago
Akihiko Odaki (@fn_aki@pawoo.net) 9475fbae78 Spec Extractor (#3540) 7 years ago
Akihiko Odaki (@fn_aki@pawoo.net) 00e61d6807 Spec action verification of StreamEntryFinder (#3549) 7 years ago
Akihiko Odaki (@fn_aki@pawoo.net) ce7c0def88 Remove redundant code in AtomSerializer and spec (#3528)
* Remove redundant status.reply? in AtomSerializer#object

* Cover AtomSerializer more
7 years ago
Yamagishi Kazutoshi e878ddb7c0 Fix spec for #2388 (#3526) 7 years ago
Akihiko Odaki (@fn_aki@pawoo.net) 10768aa204 Spec response for forgery (#3248)
Remove protect_from_forgery in ApiController, which is disabled by the
following skip_before_action, as well.
7 years ago
Yamagishi Kazutoshi 39ea5c0e2e Improve tests for JavaScript (#3496)
- Upgrade dependencies
    - chai (3.5.0 -> 4.0.1)
    - chai-enzyme (0.6.1 -> 0.7.1)
    - sinon (2.2.0 -> 2.3.2)
- Change extensions from .jsx to .js
- Don't assign `React` to `global`
- Check code format using ESLint
7 years ago
Yamagishi Kazutoshi 509b0cfafc Add scenarios for log in (#3497) 7 years ago
Matt Jankowski d010e270e6 Remove usernames and hashtags from language detection (#3503)
* Add failing specs for hashtag and username extraction in language detector

* Remove usernames and hashtags from text before language detection

* Handle multiple instances of special case, and reduce whitespace
7 years ago
Matt Jankowski d1e08bd38c Handle nil and blank cases in Account finders (#3500) 7 years ago
Matt Jankowski 5c63523972 Spec coverage and refactor for the api/v1/accounts controllers (#3451) 7 years ago
Matt Jankowski de4681b2be Move admin/pubsubhubbub controller to admin/subscriptions (#3442) 7 years ago
Matt Jankowski 5236a62861 Improve spec coverage and clean up api/v1/blocks controller (#3464) 7 years ago
Matt Jankowski 0f155829b7 Improve spec coverage and clean up api/v1/follow_requests controller (#3465) 7 years ago
Matt Jankowski 84dda45df9 Improve spec coverage and clean up api/v1/domain_blocks controller (#3466) 7 years ago
Matt Jankowski 75cad1d9d6 Improve spec coverage and clean up api/v1/favourites controller (#3472) 7 years ago
Matt Jankowski 2cc3111a77 Expand spec coverage and refactor the `Account.find_` methods (#3485)
* Move specs for account finder methods to concern spec

* Move account finder methods to concern

* Improve spec wording

* Use more explicit comparison to ensure correct return value

* Add coverage for .find_local! and .find_remote!

* Add some methods to the finder

* Use arel on matching_username method

* Avoid ternary in matching domain method

* Simplify finder methods

* Use an AccountFinder class to simplify lookup
7 years ago
Matt Jankowski bf811e4d4a Improve spec coverage and clean up api/v1/mutes controller (#3481) 7 years ago
Matt Jankowski d6774d2ca3 Refactor and spec coverage for api/v1/timelines actions (#3482) 7 years ago
Yamagishi Kazutoshi 1a4860a57a Hold value of I18n.locale with ApplicationHelperSpec (#3474) 7 years ago
Yamagishi Kazutoshi 41fa53253c Keep ENV['LOCAL_HTTPS'] with ApplicationControllerSpec (fix random fail) (#3479)
* Keep ENV['LOCAL_HTTPS'] with ApplicationControllerSpec (fix random fail)

* use climate_control
7 years ago
Matt Jankowski 8235623362 Improve spec coverage and clean up api/v1/media controller (#3467) 8 years ago
Matt Jankowski 83435c49ea Clean up api/subscriptions controller (#3448) 8 years ago
Jack Jennings 33f669a5f8 Add status destroy authorization to policy (#3453)
* Add status destroy authorization to policy

* Create explicit unreblog status authorization
8 years ago
Matt Jankowski 3576fa0d59 Improve api oembed controller (#3450)
* Add StreamEntryFinder class to parse URLs

* Use StreamEntryFinder and clean up api/oembed controller
8 years ago
Matt Jankowski 1dcfb90202 Clean up api/salmon controller (#3449) 8 years ago
Jack Jennings 22cf18e16f Fix incorrect visibility setter in StatusPolicySpec (#3456) 8 years ago
Matt Jankowski 0ebe7d6d23 Remove exports/base controller in favor of shared concern (#3444) 8 years ago
Akihiko Odaki 7db98aa70e Refactor User and spec (#3431)
* Protect send_devise_notification of User

* Improve spec for User
8 years ago
Jack Jennings e031fd60ad Move status reblog authorization into policy (#3425) 8 years ago
Akihiko Odaki 76fa9d2488 Use around hook to restore context in InstancePresenter spec (#3430) 8 years ago
Akihiko Odaki dfc43a6d3d Use around hook to restore context in InstanceHelper spec (#3429) 8 years ago
Akihiko Odaki 67bc58dd60 Use around hook to restore context in Admin::SettingsController spec (#3428) 8 years ago
Akihiko Odaki 2d39560dc1 Use around hook to restore context in ApplicationHelper spec (#3432) 8 years ago
Yamagishi Kazutoshi e0ada97770 Update dependencies of Node.js (#3067)
* Update autoprefixer to version 7.1.0

* Update axios to version 0.16.1

* Update babel-cli to version 6.24.1

* Update babel-eslint to version 7.2.3

* Update babel-preset-react to version 6.24.1

* Update coffee-script to version 1.12.6

* Update css-loader to version 0.28.1

* Update express to version 4.15.2

* Update js-yaml to version 3.8.4

* Update mocha to version 3.4.1

* Update jsdom to version 10.1.0

* Update npmlog to version 4.1.0

* Update postcss-smart-import to version 0.7.0

* Update postcss-loader to version 2.0.5

* Update pg to version 6.1.5

* Update prop-types to version 15.5.10

* Update rails-ujs to version 5.1.1

* Update redis to version 2.7.1

* Update sass-loader to version 6.0.5

* Update stringz to version 0.2.0

* Update webpack to version 2.5.1

* Update style-loader to version 0.17.0

* Update sinon to version 2.2.0

* Update react-motion to version 0.5.0

* Update react-notification to version 6.7.0

* Update react-redux-loading-bar to version 2.9.0

* Update react-intl to version 2.3.0

* Update redux-immutable to version 4.0.0

* Update reselect to version 3.0.1

* Update react-toggle to version 3.0.1

* Update react-simple-dropdown to version 3.0.0

* Update react-router to version 3.0.5

* Update react-router-scroll to version 0.4.2

* Update react-toggle to version 4.0.1

* yarn upgrade
8 years ago
Jack Jennings 3a2003ba86 Extract authorization policy for viewing statuses (#3150) 8 years ago
Akihiko Odaki 922fb74197 Remove methods from ObfuscateFilename and spec (#3347)
* Remove methods from ObfuscateFilename

* Spec ObfuscateFilename
8 years ago
Akihiko Odaki 7bf2d6cb06 Spec Auth::ConfirmationsController (#3348) 8 years ago
Akihiko Odaki 11e5c965c3 Spec AccountControllerConcern (#3349) 8 years ago
Akihiko Odaki 34157d118c Cover Admin::ReportsController more (#3346) 8 years ago
Akihiko Odaki 7b92950f1c Cover InstancesController more (#3342) 8 years ago
Akihiko Odaki 97d7028c31 Cover Admin::SuspensionsController more (#3350) 8 years ago
Akihiko Odaki a7f2961621 Spec Auth::PasswordsController (#3352) 8 years ago
Akihiko Odaki 00dda99789 Spec Admin::ResetsController calls send_reset_password_instructions (#3354) 8 years ago
Akihiko Odaki 2e27ce3b61 Spec #destroy feature of Admin::TwoFactorAuthenticationsController (#3355) 8 years ago
Akihiko Odaki 2c10c5a069 Coever Admin::SilencesController more (#3356) 8 years ago
Akihiko Odaki bd4dd4c4a0 Cover Settings::ExportsController more (#3358) 8 years ago
Akihiko Odaki 7d33b60f3f Cover Oauth::AuthorizedApplicationsController (#3359) 8 years ago
Akihiko Odaki aecce5694b Cover Oauth::AuthorizationsController more (#3361) 8 years ago
Akihiko Odaki 0e4ca51951 Cover Settings::TwoFactorAuthenticationsController more (#3376) 8 years ago
Akihiko Odaki dde043f6cd Cover WellKnown::HostMetaController more (#3382) 8 years ago
Akihiko Odaki c778a60e4f Cover Settings::TwoFactorAuthentication::RecoveryCodesController more (#3383) 8 years ago
Akihiko Odaki c347327d54 Spec Settings::Exports (#3384)
* Spec output of Settings::Exports::BlockedAccountsController

* Spec output of Settings::Exports::FollowingAccountsController

* Spec output of Settings::Exports::MutedAccountsController

* Spec Settings::Exports::BaseController

This commit removes duplicate specs in classes inheriting
Settings::Exports::BaseController as well.
8 years ago
Akihiko Odaki fd328cf6e8 Cover WellKnown::WebfingerController more (#3385) 8 years ago
Akihiko Odaki 7b473d7514 Cover Settings::TwoFactorAuthentication::ConfirmationsController more (#3386) 8 years ago
Akihiko Odaki dff576b75d Cover ApplicationHelper more (#3412) 8 years ago
Akihiko Odaki 52ae83d008 Spec Activitystreams2BuilderHelper (#3413) 8 years ago
Akihiko Odaki 5aacd9d4c7 Spec FlashesHelper (#3414) 8 years ago
Akihiko Odaki d24d3fa283 Spec HomeHelper (#3415) 8 years ago
Akihiko Odaki c8a226f61c Spec HttpHelper (#3416) 8 years ago
Akihiko Odaki 7a281c477a Cover Admin::PubSubHubHubController more (#3343) 8 years ago
Atsushi Yamamoto 402c19a924 Add preference setting for delete toot modal (#3368)
* Set delete_modal preference to true by default
* Does not show confirmation modal if delete_modal is false
* Add ja translation for preference setting page
8 years ago
happycoloredbanana 9642601126 Avoid comparing domains when looking for an exact match of a local account (#3336) 8 years ago
Akinori MUSHA f6a93fc150 Go to root after login in single user mode (#3289)
In single user mode, visitors are redirected to the single user's
profile page.  So, if you are the owner without a session, you start
from that page, click the login button and authenticate yourself
expecting you'll soon get started with the home page, but in reality
you'll get redirected back to where you started from -- your own
profile page.

This fixes the behavior by redirecting you home after login if you
have started from your own profile page.
8 years ago
Akihiko Odaki 019f3377bb Spec Admin::BaseController (#3328) 8 years ago
Akihiko Odaki a8736aab7a Cover TagsController more (#3306) 8 years ago
abcang bbc3db8b20 Add test when hashtag and URL are concatenated (#3279) 8 years ago
Yamagishi Kazutoshi f937cad68f Skip formatting for cashtag in status text (#3275)
Resolve #3270
8 years ago
Akihiko Odaki 5d9f479538 Cover HomeController more (#3258) 8 years ago
Eugen Rochko 2ca1f0737a Fix Devise destroy method being available to delete user record (#3266)
(You may think that we need account deletions, but this way would've just orphaned the db records)
8 years ago
alpaca-tc 7ee5fc5d68 Toggle sensitive from admin page (#3261) 8 years ago
Matt Jankowski 4289ed1d13 Refactor of API timeline actions (#3263)
- Increase coverage to exercise all parts of each action
- Move into namespace to share common code
- Misc refactor of each action for smaller methods, simpler code
8 years ago
Akihiko Odaki 152b4d54e8 Cover StatusesController more (#3259) 8 years ago
Akihiko Odaki ea2ef16ea4 Cover StreamEntriesController more and remove redundant instructions (#3257)
* Cover StreamEntriesController more

* Remove redundant instructions in StreamEntriesController
8 years ago
Akihiko Odaki 1d3e0a5060 Spec AuthorizeFollowsController assigns @account (#3246)
@account is used by the view.
8 years ago
Akihiko Odaki bf575a1f5e Introduce recent to Follow (#3247)
Introduce recent to Follow, as Account and other models have.
This change also adds specs for the scope and the dependents.
8 years ago
Akihiko Odaki 8fd174298d Cover AccountsController more in spec (#3229)
* Introduce recent scope to Status and StreamEntry

Introduce recent scope to Status and StreamEntry as Account has.

* Cover AccountsController more in AccountsController
8 years ago
Matt Jankowski a28ce13b3e Coverage for api/web/settings controller (#3238) 8 years ago
Matt Jankowski e1b42e9aa0 Add coverage for ReportFilter and AccountFilter (#3236) 8 years ago
Matt Jankowski ec34ec63b1 Specs for cleanup workers (#3235)
* Add spec files for feed and media cleanup workers

* Add coverage for feed and media cleanup schedulers

* Clean up feed and media cleanup workers
8 years ago
Akihiko Odaki bda7391221 Cover ApplicationController more in spec (#3230) 8 years ago