about summary refs log tree commit diff
path: root/lib
AgeCommit message (Collapse)Author
2021-10-14Fix tootctl self-destruct not sending Delete activities for ↵Claire
recently-suspended accounts (#16688) * Do not block existing users' emails on self-destruct That is wasteful and unintuitive * Do not close registrations when running tootctl self-destruct with --dry-run * Close registrations on self-destruct regardless of known remote accounts * Fix tootctl self-destruct not sending Deletes for recently-suspended accounts * Suspend local users even if no remote account is known * Do not show scary confirmation text if ran with --dry-run
2021-09-29Switch from unmaintained paperclip to kt-paperclip (#16724)Claire
* Switch from unmaintained paperclip to kt-paperclip * Drop some compatibility monkey-patches not required by kt-paperclip * Drop media spoof check monkey-patching It's broken with kt-paperclip and hopefully it won't be needed anymore * Fix regression introduced by paperclip 6.1.0 * Do not rely on pathname to call FastImage * Add test for ogg vorbis file with cover art * Add audio/vorbis to the accepted content-types This seems erroneous as this would be the content-type for a vorbis stream without an ogg container, but that's what the `marcel` gem outputs, so… * Restore missing for_as_default method * Refactor Attachmentable concern and delay Paperclip's content-type spoof check Check for content-type spoofing *after* setting the extension ourselves, this fixes a regression with kt-paperclip's validations being more strict than paperclip 6.0.0 and rejecting some Pleroma uploads because of unknown extensions. * Please CodeClimate * Add audio/vorbis to the unreliable set It doesn't correspond to a file format and thus has no extension associated.
2021-08-09Add feature to automatically delete old toots (#16529)Claire
* Add account statuses cleanup policy model * Record last inspected toot to delete to speed up successive calls to statuses_to_delete * Add service to cleanup a given account's statuses within a budget * Add worker to go through account policies and delete old toots * Fix last inspected status id logic All existing statuses older or equal to last inspected status id must be kept by the current policy. This is an invariant that must be kept so that resuming deletion from the last inspected status remains sound. * Add tests * Refactor scheduler and add tests * Add user interface * Add support for discriminating based on boosts/favs * Add UI support for min_reblogs and min_favs, rework UI * Address first round of review comments * Replace Snowflake#id_at_start with with_random parameter * Add tests * Add tests for StatusesCleanupController * Rework settings page * Adjust load-avoiding mechanisms * Please CodeClimate
2021-08-08Fix unsupported video error message handling (#16581)Takeshi Umeda
2021-07-13Change references to tootsuite/mastodon to mastodon/mastodon (#16491)Claire
* Change references to tootsuite/mastodon to mastodon/mastodon * Remove obsolete test fixture * Replace occurrences of tootsuite/mastodon with mastodon/mastodon in CHANGELOG And a few other places
2021-07-08Add ability to skip sign-in token authentication for specific users (#16427)Eugen Rochko
Remove "active within last two weeks" exception for sign in token requirement Change admin reset password to lock access until the password is reset
2021-07-07Add --by-uri option to `tootctl domains purge` (#16434)Claire
Fixes #16410
2021-06-03Update emoji codepoint mappings to v13.1 (#16352)Claire
2021-06-03Bump version to 3.4.1 (#16350)Eugen Rochko
2021-06-02Fix migration script not being able to run if it fails midway (#16312)Claire
* Fix migration script not being able to run if it fails midway * Fix old migration script * Fix old migration script * Refactor CorruptionError
2021-06-02Fix account deletion sometimes failing because of optimistic locks (#16317)Claire
* Fix account deletion sometimes failing because of optimistic locks In some rare occasions[1], deleting accounts would fail with a `StaleObjectError` exception. Indeed, account deletion manually sets the `AccountStat` values without handling cases where the optimistic locking on `AccountStat` would fail. To my knowledge, with the rewrite of account counters in #15913, the `DeleteAccountService` is now the only place that changes the counters in a way that is not atomic. Since in this specific case, we do not care about the previous values of the account counters, it appears we don't need locking at all for this table anymore. [1]: https://discourse.joinmastodon.org/t/account-cant-be-deleted/3602 * Bump MAX_SUPPORTED_VERSION in maintenance script
2021-06-01Fix `tootctl search deploy` on Ruby 3 (#16346)Claire
Fixes #16344
2021-05-16Bump version to 3.4.0 (#16239)Eugen Rochko
2021-05-16Add more checks to `repo:check_locales_files` (#16249)Eugen Rochko
2021-05-12Update fix-duplicates maintenance script to support latest migrations (#16231)Claire
* Update maintenance script to support latest database migrations * Update Account#merge_with!
2021-05-11Fix animated GIF generates animated thumbnail (#16216)rinsuki
2021-05-10Bump version to 3.4.0rc2 (#16206)Eugen Rochko
2021-05-09Add a Redis environment variable for sidekiq (#16188)Takeshi Umeda
2021-05-08Bump version to 3.4.0rc1 (#16053)Eugen Rochko
2021-05-07Fix older migrations on Ruby 3 (#16174)Claire
2021-05-06Add Ruby 3.0 support (#16046)Claire
* Fix issues with POSIX::Spawn, Terrapin and Ruby 3.0 Also improve the Terrapin monkey-patch for the stderr/stdout issue. * Fix keyword argument handling throughout the codebase * Monkey-patch Paperclip to fix keyword arguments handling in validators * Change validation_extensions to please CodeClimate * Bump microformats from 4.2.1 to 4.3.1 * Allow Ruby 3.0 * Add Ruby 3.0 test target to CircleCI * Add test for admin dashboard warnings * Fix admin dashboard warnings on Ruby 3.0
2021-05-05Fix media redownload worker retrying on unexpected response codes (#16111)Eugen Rochko
2021-05-05Fix media processing getting stuck on too much stdin/stderr (#16136)Eugen Rochko
* Fix media processing getting stuck on too much stdin/stderr See thoughtbot/terrapin#5 * Remove dependency on paperclip-av-transcoder gem * Remove dependency on streamio-ffmpeg gem * Disable stdin on ffmpeg process
2021-05-05Fix how to change connection pool for rails 6 (#16158)Takeshi Umeda
* Fix how to change connection pool for rails 6 * Fix to match the code elsewhere
2021-04-29Fix cache redis not being used (#16131)Takeshi Umeda
2021-04-27Fix typo in db.rake (#16126)Ikko Ashimine
occured -> occurred
2021-04-13Add border to 🚲 emoji (#16035)Claire
2021-04-12Remove dependency on pluck_each gem (#16012)Eugen Rochko
2021-03-31Fix DB connection pool settings in CLI (#15983)abcang
2021-03-24tootctl emoji import: case insensitive duplicate check (#15738)Stanislas
2021-03-24Update Mastodon to Rails 6.1 (#15910)Claire
* Update devise-two-factor to unreleased fork for Rails 6 support Update tests to match new `rotp` version. * Update nsa gem to unreleased fork for Rails 6 support * Update rails to 6.1.3 and rails-i18n to 6.0 * Update to unreleased fork of pluck_each for Ruby 6 support * Run "rails app:update" * Add missing ActiveStorage config file * Use config.ssl_options instead of removed ApplicationController#force_ssl Disabled force_ssl-related tests as they do not seem to be easily testable anymore. * Fix nonce directives by removing Rails 5 specific monkey-patching * Fix fixture_file_upload deprecation warning * Fix yield-based test failing with Rails 6 * Use Rails 6's index_with when possible * Use ActiveRecord::Cache::Store#delete_multi from Rails 6 This will yield better performances when deleting an account * Disable Rails 6.1's automatic preload link headers Since Rails 6.1, ActionView adds preload links for javascript files in the Links header per default. In our case, that will bloat headers too much and potentially cause issues with reverse proxies. Furhermore, we don't need those links, as we already output them as HTML link tags. * Switch to Rails 6.0 default config * Switch to Rails 6.1 default config * Do not include autoload paths in the load path
2021-03-24Change mastodon:setup to not call assets:precompile in docker (#13942)Claire
It appears assets are built during image build, and they shouldn't need to be rebuilt, since we now have reproducible builds.
2021-03-19Improve account counters handling (#15913)Claire
* Improve account counters handling * Use ActiveRecord::Base::sanitize_sql to pass values instead of interpolating them Keep using string interpolation for `key` as it is safe and using “ActiveRecord::Base::sanitize_sql_hash_for_assignment” would require stitching bits of SQL in a way that is not more easily checked for safety. * Add migration hook to catch PostgreSQL versions earlier than 9.5
2021-03-19Remove MySQL-specific code from Mastodon::MigrationHelpers (#15924)Claire
Mastodon::MigrationHelpers has been forked from Gitlab a long time ago, but Mastodon has never supported using a MySQL database. Removing MySQL support from Mastodon::MigrationHelpers makes it a little easier to maintain. In particular, it removes code that would need updating with Rails 6.
2021-03-19Change deduplication order of tootctl maintenance fix-duplicates (#15923)Claire
Hopefully fixes #15922 Also update support up to latest database schema version
2021-03-19Further preparation for Rails 6 (#15916)Claire
* 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.
2021-03-19Use more robust hook for loading timestamp_id function into database (#15919)Claire
2021-03-19Prepare Mastodon for zeitwerk autoloader (#15917)Claire
* Prepare Mastodon for zeitwerk autoloader (Rails 6) Add inflections and rename/move a few classes. In particular, app/lib/exceptions.rb and app/lib/sanitize_config.rb were manually loaded while still in autoload paths. * Add inflection for Url → URL
2021-03-17Prepare Mastodon for Rails 6 (#15911)Claire
* 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
2021-03-01Add borders to 📱 and 📲 emojis (#15794)Claire
2021-02-19replace all instances of "ends_with?" with "end_with?" (#15745)Justin Tracey
The "ends_with?" method is just a Rails alias of Ruby's "end_with?" method. Using the latter makes the code less brittle.
2021-02-16use host instead of headers to make Rack happy (#15741)Justin Tracey
"headers" is provided by Rails, Rack can't rely on it
2021-02-14Monkey patch Rack::Session to send secure cookies to onions (#15725)Cecylia Bocovich
2021-02-11Drop dependency on secure_headers, fix response headers (#15712)Claire
* Drop dependency on secure_headers, use always_write_cookie instead * Fix cookies in Tor Hidden Services by moving configuration to application.rb * Instead of setting always_write_cookie at boot, monkey-patch ActionDispatch
2021-02-11Fix obsolete digitalocean.rake file breaking rake tasks (#15618)Claire
2021-01-31Fixed code quality issues (#15541)Shubhendra Singh Chauhan
* Added .deepsource.toml * Removed bad use of `alias` * Fixed operand order in the binary expression * Prefixed unused method arguments with an underscore * Replaced the old OpenSSL algorithmic constants with the newer strings initializers. * Removed unnecessary UTF-8 encoding comment
2021-01-29Fix “tootctl accounts unfollow” (#15639)ThibG
Fixes #15635 Co-authored-by: Claire <claire.github-309c@sitedethib.com>
2021-01-22Optimize some regex matching (#15528)luigi
* Use Regex#match? * Replace =~ too * Avoid to call match? from Nil * Keep value of Regexp.last_match
2021-01-12Use Rails' index_by where it makes sense (#15542)ThibG
* Use Rails' index_by where it makes sense * Fix tests Co-authored-by: Claire <claire.github-309c@sitedethib.com>
2021-01-10Optimize map { ... }.compact calls (#15513)luigi
* Optimize map { ... }.compact using Enumerable#filter_map, supported since Ruby 2.7 * Add poyfill for Enumerable#filter_map