Commit Graph

15 Commits

Author SHA1 Message Date
evazion
f4953549ae jobs: switch from DelayedJob to GoodJob.
Switch the ActiveJob backend from DelayedJob to GoodJob. Differences:

* The job worker is run with `bin/good_job start` instead of `bin/delayed_job`.
* Jobs have an 8 hour timeout instead of a 4 hour timeout.
* Jobs don't automatically retry on failure.
* Finishing jobs are preserved and pruned after 7 days.
2022-01-04 13:52:08 -06:00
evazion
1653392361 posts: stop updating fav_string attribute.
Stop updating the fav_string attribute on posts. The column still exists
on the table, but is no longer used or updated.

Like the pool_string in 7d503f08, the fav_string was used in the past to
facilitate `fav:X` searches. Posts had a hidden fav_string column that
contained a list of every user who favorited the post. These were
treated like fake hidden tags on the post so that a search for `fav:X`
was treated like a tag search.

The fav_string attribute has been unused for search purposes for a while
now. It was only kept because of technicalities that required
departitioning the favorites table first (340e1008e) before it could be
removed. Basically, removing favorites with `@favorite.destroy` was
slow because Rails always deletes object by ID, but we didn't have an
index on favorites.id, and we couldn't easily add one until the
favorites table was departitioned.

Fixes #4652. See https://github.com/danbooru/danbooru/issues/4652#issuecomment-754993802
for more discussion of issues caused by the fav_string (in short: write
amplification, post table bloat, and favorite inconsistency problems).
2021-10-09 22:36:26 -05:00
evazion
058d71aa30 user upgrades: send dmail to purchaser for gifted upgrades.
* Refactor to move upgrade logic from UserPromotion to UserUpgrade.
* Send the recipient and the purchaser of a gifted upgrade separate
  dmail notifications.
2020-12-25 00:43:58 -06:00
evazion
c82e05d828 users: add stricter checks for user promotions.
New rules for user promotions:

* Moderators can no longer promote other users to moderator level. Only
  Admins can promote users to Mod level. Mods can only promote up to Builder level.
* Admins can no longer promote other users to Admin level. Only Owners
  can promote users to Admin. Admins can only promote up to Mod level.
* Admins can no longer demote themselves or other admins.

These rules are being changed to account for the new Owner user level.

Also change it so that when a user upgrades their account, the promotion
is done by DanbooruBot. This means that the inviter and the mod action
will show DanbooruBot as the promoter instead of the user themselves.
2020-12-13 21:21:08 -06:00
evazion
cb49489f1e tests: remove SKIP_CLOUDFLARE_CHECK env variable.
This was a hack to deal with the Cloudflare check sometimes being slow
or timing out during tests. The call to https://api.cloudflare.com/client/v4/ips
could hang if there were IPv6 connectivity problems. If this happens, make
sure that IPv6 is configured properly and that `curl -v --http1.1 -6 https://api.cloudflare.com/client/v4/ips`
works.
2020-05-12 15:50:42 -05:00
evazion
b21e1d219c users: remove as_admin and as_current methods. 2020-03-21 23:06:42 -05:00
evazion
309821bf73 rubocop: fix various style issues. 2019-12-22 21:23:37 -06:00
evazion
0df5c0fd2b Replace deprecated update_attributes with update.
https://rubyinrails.com/2019/04/09/rails-6-1-activerecord-deprecates-update-attributes-methods/

DEPRECATION WARNING: update_attributes! is deprecated and will be removed from Rails 6.1 (please, use update! instead)
2019-08-25 20:29:32 -05:00
evazion
82fbb19e0f users: drop unused code. 2019-08-18 11:24:42 -05:00
evazion
27a118dfc8 tests: drop timecop gem. 2019-08-18 11:24:41 -05:00
r888888888
192ac128cd add additional meta tags for seo 2018-10-20 17:15:29 -07:00
evazion
6ff70c5002 mod actions: separate account upgrades from promotions (fix #3841) 2018-08-26 11:12:04 -05:00
Albert Yi
a610111658 switch post previews to use flexbox, add better styling for cropped thumbnails 2018-07-18 11:38:00 -07:00
Albert Yi
64446d49e1 add image cropping support 2018-06-22 14:41:57 -07:00
evazion
fcec99405c Fix failure in rake db:migrate on fresh install (#3443).
Create the DanbooruBot account in db/seeds.rb instead of in an
initializer. Move the old db/seeds.rb to db/populate.rb.

Fixes a bug introduced in e2eb45a. Creating DanbooruBot in an
initializer was wrong because in a fresh install the users table doesn't
exist yet. This caused `rake db:migrate` to fail.
2017-12-21 12:08:08 -06:00