Commit Graph

306 Commits

Author SHA1 Message Date
evazion
87c480e2ed tests: fix /users?name=<nonexistent> test. 2019-08-22 21:30:00 -05:00
evazion
0b14146f6a posts: hotfix bug in /posts.json?tags=blah+order:random. 2019-08-19 18:51:33 -05:00
evazion
782d9f3d61 comment votes: fix error handling.
Return the comment itself and a standard error response on failure.
2019-08-19 17:22:36 -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
evazion
27a118dfc8 tests: drop timecop gem. 2019-08-18 11:24:41 -05:00
evazion
d657624a80 Revert "application controller: fix errors in normalize_search."
This reverts commit 28a88cfa85.
2019-08-14 01:46:43 -05:00
evazion
d0428da120 sessions: remove nonexistent GET /session route. 2019-08-14 01:46:43 -05:00
evazion
dbfd6185f1 posts: fix error on /posts?md5=<does_not_exist>. 2019-08-13 21:30:21 -05:00
evazion
0f98631908 wiki pages: fix error in /wiki_pages/does_not_exist.json 2019-08-13 21:30:21 -05:00
evazion
28a88cfa85 application controller: fix errors in normalize_search.
Fix exceptions in `normalize_search` on e.g. `https://danbooru.donmai.us/users?search=blah`.
Caused when the `search` param is not a hash.
2019-08-13 21:30:20 -05:00
evazion
a28a58c1f6 tests: add more posts/index controller tests. 2019-08-12 13:38:45 -05:00
evazion
d76be490f2 Remove tag alias corrections controller tests (fixup 18a216c67). 2019-08-10 23:49:32 -05:00
evazion
35dfc704bc application controller: fix bad file extension errors.
Fix requests with bad file extensions not always returning errors correctly:

* https://danbooru.donmai.us/posts.jpg
* https://danbooru.donmai.us/posts.blah
* https://danbooru.donmai.us/posts/bad.jpg
* https://danbooru.donmai.us/posts/bad.blah
2019-08-08 22:16:39 -05:00
evazion
39bd766b34 Fix #4053: Add disapproval index improvements.
Add search form to /moderator/post/disapprovals.
2019-08-02 22:03:03 -05:00
Albert Yi
0a058dd52b fixes #4080: Status code 500 when disapproving through API 2019-05-17 12:09:03 -07:00
Albert Yi
c18cf5480d update uploadcontroller test 2019-04-16 16:26:38 -07:00
Albert Yi
33063a72de Add a listing page for post disapprovals (accessible to approvers only) 2019-01-24 16:14:57 -08:00
evazion
d32882e1ee aliases/implications: fix controller tests. 2018-12-31 19:08:15 -06:00
Albert Yi
0508b127fd continue refactoring savedsearch 2018-11-15 12:06:13 -08:00
evazion
115ed16a96 pools: store post_ids as array instead of string (fix #3979) 2018-11-08 15:09:31 -06:00
evazion
ed47db0e48 upload tags report: add controller test (#3975). 2018-11-06 18:29:27 -06:00
evazion
98cffc310b Fix pool elements controller tests. 2018-11-04 21:25:25 -06:00
evazion
6148cb39a2 Fix nested blank search params not being stripped from searches.
From https://danbooru.donmai.us/forum_topics/9127?page=258#forum_post_151308:

    When you do a user search (from https://danbooru.donmai.us/users/search)
    the results only include those with someone in the inviter field.

The bug was that nested blank search params (/users?search[inviter][name_matches]=)
didn't get stripped from the search.
2018-10-17 16:11:44 -05:00
evazion
1e710e1ae0 tests: fix typo in artist controller test. 2018-10-04 21:55:17 -05:00
evazion
151fa00933 tests: fix tests for /comments/new, /post_flags/new. 2018-10-01 10:38:15 -05:00
evazion
d1e9f9c3ce Fix broken test artist controller tests, tag alias test. 2018-09-26 00:42:47 -05:00
evazion
6fe883c316 posts index: clean up limit:<n> / order:random parsing (#2894)
* Move the limit:<n> / order:random metatag parsing from the controller
  to the post set.

* Introduce `Tag.has_metatag?` and use it to parse these metatags
  instead of using a regex (#2894).
2018-09-20 19:23:47 -05:00
Albert Yi
ed5b2ad443 throw error on counts/posts endpoint during a timeout (#2170) 2018-09-19 13:34:50 -07:00
evazion
c9b3c8d217 artist urls: add tests for controller + artist url search. 2018-09-15 19:58:55 -05:00
evazion
10ca4dd3ad artists: replace artist finder with fetch source data.
* On posts, automatically trigger "Fetch source data" when clicking the
  Edit tab, instead of triggering the artist finder button. This way we
  find both the artist and the translated tags in one ajax call.

* Remove the "Artist" finder button next to the source field. This isn't
  necessary given that "Fetch source data" finds the artist itself.

* Remove the /artists/finder.json API endpoint. This is no longer used
  after removing the "Artist" finder button.
2018-09-11 20:09:25 -05:00
Albert Yi
e0e85a3139 skip additional tests failures that are caused by networking issues 2018-09-11 13:43:34 -07:00
Albert Yi
30a5d745a0 additional spec fixes 2018-09-04 14:01:35 -07:00
Albert Yi
762dc3da24 Refactor sources 2018-08-24 12:10:51 -07:00
Albert Yi
6ce8c72053 assign after source url for uploads 2018-07-31 10:10:50 -07:00
Albert Yi
77854349e5 testing 2018-07-26 18:11:19 -07:00
r888888888
344c46ed00 add mock recommender service for development, add user-context recommended posts 2018-07-21 14:02:57 -07:00
Albert Yi
abcef9115b fix tests 2018-07-20 13:52:56 -07:00
Albert Yi
75162d3d8b bug fixes + tests 2018-07-20 12:31:28 -07:00
Albert Yi
7f895bd91f fix specs 2018-07-02 15:19:19 -07:00
Albert Yi
867406f410 handle the case where a file is uploaded that doesn't match whatever was preprocessed 2018-07-02 14:47:23 -07:00
Albert Yi
c17e0baad0 prefer file over source when both are provided (#3767) 2018-06-25 14:00:02 -07:00
r888888888
62235e215e iqdb fixes 2018-06-23 11:15:14 -07:00
r888888888
3ba5c6fb51 refactor iqdb endpoints 2018-06-23 10:59:04 -07:00
Albert Yi
9510dead9f refactor iqdb query support 2018-06-19 14:16:12 -07:00
Albert Yi
fdd7582fb0 add support for upload preprocessing 2018-06-14 17:52:41 -07:00
Albert Yi
6c14d19010 fix tests 2018-06-05 16:08:45 -07:00
Albert Yi
856637ace4 fix tests 2018-06-05 15:51:06 -07:00
Albert Yi
63ab637419 potential fix for #3727 2018-05-25 10:16:52 -07:00
Albert Yi
308cfc2376 reduce constraints for when to show forum post vote links (#3691) 2018-05-15 11:20:16 -07:00
Albert Yi
32ad389581 Merge branch 'circleci-fixes' 2018-05-15 10:34:26 -07:00