Commit Graph

1649 Commits

Author SHA1 Message Date
evazion
97cc873a3f maintenenace: fix db timeouts during vacuuming.
Setting the statement timeout at the beginning didn't work because
`PostPruner.new.prune!` clobbers the timeout (it calls `without_timeout`,
which doesn't restore the timeout properly if the timeout was zero).
2019-08-22 17:03:18 -05:00
evazion
ac259859f9 search: don't error out on source:*pixiv* searches. 2019-08-21 23:33:49 -05:00
evazion
0b14146f6a posts: hotfix bug in /posts.json?tags=blah+order:random. 2019-08-19 18:51:33 -05:00
evazion
dab43d96c9 jobs: migrate mass updates to ActiveJob.
Also fixes a bug where mod actions weren't logged on mass updates.
Creating the mod action silently failed because it was called when
CurrentUser wasn' set.
2019-08-19 00:46:31 -05:00
evazion
ddcc7eddfb jobs: migrate fixing post counts to ActiveJob. 2019-08-19 00:46:30 -05:00
evazion
576b4feb3b views: convert mod dashboard + admin user edit page to simple form.
Fixes bug with the user level select dropdown on the mod dashboard page
missing the builder level.
2019-08-18 11:24:42 -05:00
evazion
59b277ead1 users: drop id_to_name, name_to_id caching.
Changes:

* Drop Users.id_to_name.
* Don't cache Users.name_to_id.
* Replace calls to name_to_id with find_by_name when possible.
* Don't autodefine creator_name in belongs_to_creator.
* Don't autodefine updater_name in belongs_to_updater.
* Instead manually define creator_name / updater_name only on models that need
  to return these fields in the api.

id_to_name was cached to reduce the impact of N+1 query patterns in
certain places, especially in api responses that return creator_name /
updater_name fields. But it still meant we were doing N calls to
memcache. Using `includes` to prefetch users avoids this N+1 pattern.

name_to_id had no need be cached, it was never used in any performance-
sensitive contexts.

Avoiding caching also avoids the need to keep these caches consistent.
2019-08-18 11:24:42 -05:00
lllusion3469
b15fd6d017 Fix Ugoiras when image cropping is disabled
since file is nil and has no #close! when Danbooru.config.enable_image_cropping is false
2019-08-17 19:52:23 -05:00
evazion
868a2256d1 jobs: migrate file deletion jobs to ActiveJob. 2019-08-16 20:49:35 -05:00
evazion
4e8b3d9310 jobs: migrate user deletions to ActiveJob. 2019-08-16 20:49:34 -05:00
evazion
798d524e60 Post#tag_match: clean up read_only param.
* Drop /posts?ro=true param (broken).
* Clean up tag_match (rescuing PG::ConnectionBad didn't do anything, we
  just build the query here, we don't run it).
2019-08-16 00:26:00 -05:00
evazion
bb157f5d5b models: drop various unused #named methods. 2019-08-15 19:18:19 -05:00
evazion
b9d35eaf2c Fix #3272: Unicode tags are still being allowed.
* Don't allow adding tags with invalid names when they already exist in
  the tags table.
* If an invalid tag is added, show an warning and ignore the tag instead
  of failing with a hard error.
* Move the _(cosplay) tag validation into the tag name validator.
2019-08-15 16:42:23 -05:00
evazion
5f1226ca92 Rename maintenance.rb -> danbooru_maintenance.rb.
Fixes random test failures caused by ambiguous constant lookup issues
(the `Maintenance` module name was used in multiple conflicting places).
2019-08-15 00:36:25 -05:00
evazion
ca2e2c92b9 artist versions: fix uninitialized constant error.
Error appears intermittently depending on module load order.
2019-08-13 21:30:20 -05:00
evazion
e70cae457d application controller: clean up exception handling.
* Simplify code.
* Show backtraces for all users, not just builders.
* Show backtraces only for unexpected server errors (status 5xx), not
  for normal client errors (status 4xx).
* Log expected errors at info level (reduce noise in production logs).
2019-08-13 21:30:20 -05:00
evazion
14da425564 search: reduce queries in single tag searches (#4120).
Avoid some queries used in wiki page excerpts:

* Only try to load the artist if the tag is an artist tag.
* Avoid using `exists?` queries for wiki pages.
* Bugfix: don't show wiki excerpts for deleted wikis.
2019-08-12 13:38:45 -05:00
evazion
18a216c67a Fix #4130: Remove tag alias corrections. 2019-08-10 22:46:49 -05:00
evazion
c7bcce429e Fix #4129: Remove tag alias caching. 2019-08-10 22:04:55 -05:00
evazion
96b28a77e7 delayed jobs: drop failed jobs email alert.
Usually when jobs aren't working it's not because the jobs themselves
are failing, it's because the workers crashed and aren't processing jobs
at all.
2019-08-10 12:06:23 -05:00
evazion
4f024d2360 pools/show: fix N+1 query on pool show page.
Fix a N+1 query when fetching posts to render thumbnails. Also adds
support for the `limit` url param on the posts show page.
2019-08-09 00:05:50 -05:00
evazion
df433bda9c newrelic: log more request context. 2019-08-08 22:16:39 -05:00
evazion
9a6add9730 newrelic: refactor error logging.
* Factor out New Relic logging to DanbooruLogger class.
* Log all exceptions to New Relic, not just statement timeouts.
2019-08-08 22:16:39 -05:00
evazion
8db9d700ef daily maintenance: fix 'vacuum analyze' failure during tests.
Fixup for 2df6bf41f.
2019-08-06 15:22:08 -05:00
evazion
7f482dc35b deviantart: normalize wixmp.com sources to page urls.
Normalize sources like this:

   https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/ab917938-d8c1-4b58-933d-0d38c390461f/ddcyi98-cbd39da2-f528-4b26-aadb-a16fe91442b2.jpg/v1/fill/w_1280,h_1760,q_100,strp/tifa_by_chubymi_ddcyi98-fullview.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7ImhlaWdodCI6Ijw9MTc2MCIsInBhdGgiOiJcL2ZcL2FiOTE3OTM4LWQ4YzEtNGI1OC05MzNkLTBkMzhjMzkwNDYxZlwvZGRjeWk5OC1jYmQzOWRhMi1mNTI4LTRiMjYtYWFkYi1hMTZmZTkxNDQyYjIuanBnIiwid2lkdGgiOiI8PTEyODAifV1dLCJhdWQiOlsidXJuOnNlcnZpY2U6aW1hZ2Uub3BlcmF0aW9ucyJdfQ.Uochlma4QJmLwL2ZGMmvTr4HMva4m4bCeF3vnyPSw4I

to this:

   https://www.deviantart.com/chubymi/art/Tifa-807825644

on the sidebar of the posts show page.
2019-08-06 12:04:05 -05:00
evazion
a8896b664d twitter: fix batch bookmarklet selecting wrong image.
Fix regression in 7e465aeda.

https://danbooru.donmai.us/forum_topics/9127?page=276#forum_post_158779
2019-08-06 10:42:45 -05:00
evazion
2df6bf41f6 cron: move 'vacuum analyze' to daily maintenance. 2019-08-06 10:42:45 -05:00
evazion
7e465aedae Fix #4110: New Twitter image urls are broken in bookmarklet. 2019-08-04 20:23:10 -05:00
evazion
9ecf36585c nijie: update for new image urls.
Nijie moved from this:

    https://pic03.nijie.info/nijie_picture/236014_20170620101426_0.png (page: https://www.nijie.info/view.php?id=218856)

to this:

    https://pic.nijie.net/03/nijie_picture/236014_20170620101426_0.png (page: https://www.nijie.info/view.php?id=218856)
2019-08-04 17:49:54 -05:00
evazion
fc4fa9dc6c Fix #4077: Migrate CurrentUser and safe_mode to use RequestStore. 2019-08-04 10:12:59 -05:00
evazion
692981e964 Fix #4111: Cache custom CSS. 2019-08-01 00:06:18 -05:00
evazion
efc5487dd6 Fix #4109: Censored images leaked in og:image attribute. 2019-07-31 21:47:31 -05:00
Albert Yi
f95bcc7330 move safe_mode from Thread.current to RequestStore 2019-06-26 09:26:20 -07:00
Albert Yi
04edc3f533 update factories + tests 2019-05-10 17:31:07 -07:00
Albert Yi
6612aa1af9 fix unit tests 2019-04-25 18:13:59 -07:00
Albert Yi
8a16e089d2 don't try to parse deviant art urls that lack a deviation id in the url 2019-04-16 14:00:38 -07:00
Albert Yi
6f4ca75bb1 try to handle deivantart images hosted on images-wixmp better 2019-04-16 13:55:26 -07:00
Albert Yi
eb8ce2e955 Revert "eliminate old algorithm for deviant art sources, fix canonical_url on deviantart"
This reverts commit 58ca52b43e.
2019-04-16 13:22:09 -07:00
Albert Yi
58ca52b43e eliminate old algorithm for deviant art sources, fix canonical_url on deviantart 2019-04-12 16:35:41 -07:00
Albert Yi
c051103d35 fixes #4059: Incorrect commentary description from Nicoseiga in some cases 2019-02-25 15:58:07 -08:00
Albert Yi
d8d4a5ae6f refactor nico seiga manga support 2019-02-25 15:53:07 -08:00
Albert Yi
f6a11e6363 remove residual code 2019-02-25 14:46:43 -08:00
Albert Yi
90ce42a537 add support for nico seiga manga (fixes #4060) 2019-02-25 14:44:45 -08:00
Albert Yi
a66d0353d8 include rating and uploader median score in automod events 2019-02-07 15:17:39 -08:00
Albert Yi
e69f201e2c Merge pull request #4056 from r888888888/automod
add csv export helper
2019-02-04 16:03:01 -08:00
Albert Yi
95211bfbfc add csv export helper 2019-01-31 16:37:11 -08:00
Albert Yi
d8aabff77b remove post keeper references 2019-01-31 15:45:06 -08:00
Albert Yi
cb11e96c31 handle recordnotfound errors 2019-01-30 10:58:29 -08:00
Albert Yi
2961be636a add job hook when post is created 2019-01-30 10:54:27 -08:00
Albert Yi
6243925aeb add user job for updating table in dynamodb 2019-01-30 10:37:39 -08:00