Commit Graph

9606 Commits

Author SHA1 Message Date
evazion
da40a1cb73 Fix #4463: Missing link to recent changes in pools' topbar. 2020-06-27 02:18:33 -05:00
evazion
24e299cf93 api: add /explore/posts/searches.json, /explore/posts/missed_searches.json. 2020-06-27 02:09:51 -05:00
evazion
dd857c6695 popular searches: fix blank search counts on /explore/posts/searches. 2020-06-27 02:09:09 -05:00
evazion
ff096b8adc Fix #4508: Specific tag not showing a wiki.
Fix the wiki excerpt not appearing when searching for a tag that doesn't
exist in the tag list. This could happen if someone created a wiki for a
tag that has never been used on a post.
2020-06-27 02:01:34 -05:00
evazion
f06e322dc0 Fix #4507: Clicking "View wiki" on Artists with no wiki redirects to the posts page. 2020-06-27 01:20:05 -05:00
evazion
3a6e4732bf Fix #4511: Remove delete/undelete controls from the artist index.
* Only show the delete artist button on the artist edit page.
* Only show the delete pool button on the pool edit page.
* Only show the delete wiki button on the wiki edit page.
2020-06-27 00:45:29 -05:00
evazion
f7f72e29b5 Fix #4458: Duplicate HTML IDs on post show page. 2020-06-26 14:59:30 -05:00
evazion
804a2ef9a5 Fix #4535: Comment edit forms contain duplicate IDs.
Prefix comment form IDs with `post_<id>_comment_<id>` to ensure
uniqueness.
2020-06-26 14:57:19 -05:00
evazion
5e23861bea simple form: enable HTML5 maxlength validations.
Makes it so that models that have maximum length validations will add
maxlength attributes to form fields. This includes flag reasons, appeal
reasons, and forum topic titles.

Partially fixes #4519 (Add "n/m characters remaining" character counter to the appeal reason).

https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/maxlength
2020-06-25 16:28:18 -05:00
evazion
883856d4af simple form: refactor DText form fields to use SimpleForm.
* Refactors DText form fields to use a custom SimpleForm input instead
  of manually generated html. This fixes it so that DText fields use the
  same markup as normal SimpleForm fields, which lets us apply browser
  maxlength validations to DText input fields.

* Fixes autocomplete for @-mentions only working in comments and forum posts.
  Now @-mention autocomplete works in all DText fields, including dmails.
  Known bug: it applies in artist commentary fields when it shouldn't.
2020-06-25 16:28:09 -05:00
evazion
fccdcbe7cc simple form: regenerate config with new defaults.
Regenerated with `bin/rails generate simple_form:install`.
2020-06-25 16:28:09 -05:00
evazion
44f826d8fa nicoseiga: optimize image_url method.
The image_url method makes a request to `https://seiga.nicovideo.jp/images/source/:image_id`
to see where this URL redirects to. Before we did a GET request, which caused it to download
the full image. This could fail with a timeout error if the download took too long. We also
cached the request, which caused the full image to be cached, even though we only need the
headers. Change it to a HEAD request so we don't have to download the entire image just to
check the URL.
2020-06-24 22:54:04 -05:00
evazion
5af50b7fcd danbooru::http: factor out Cloudflare Polish bypassing.
* Factor out the Cloudflare Polish bypass code to a standalone feature.

* Add `http_downloader` method to the base source strategy. This is a
  HTTP client that should be used for downloading images or making
  requests to images. This client ensures that referrer spoofing and
  Cloudflare bypassing are performed.

This fixes a bug with the upload page reporting the polished filesize
instead of the original filesize when uploading ArtStation images.
2020-06-24 22:54:04 -05:00
evazion
d3bb5c67ee danbooru::http: factor out referrer spoofing.
Factor out referrer spoofing so that it can be used outside of downloading
files. We also need to spoof the referrer when determining the remote
filesize of images on the uploads page.
2020-06-24 21:46:59 -05:00
evazion
f84ceb3938 image proxy: raise image download timeout.
Possible fix for large Pixiv previews on the upload page sometimes
returning HTTP 500 errors.
2020-06-24 19:31:47 -05:00
evazion
b09350c0dc tests: add more Tag.search tests.
Improve tag model test coverage.
2020-06-24 18:39:55 -05:00
evazion
4074cc99f9 uploads: fix incorrect remote sizes on pixiv uploads.
Bug: the uploads page showed a remote size of 146 bytes for Pixiv uploads.

Cause: we didn't spoof the Referer header when making the HEAD request
for the image, causing Pixiv to return a 403 error.

Also fix the case where the Content-Length header is absent.
2020-06-24 03:02:45 -05:00
evazion
8eac82a971 pixiv: fix regression with new user profile urls.
* Update tests to use new Pixiv profile urls.
* Fix issue with artist finder not working when given direct image or
  html page urls.
2020-06-24 02:41:11 -05:00
evazion
1d369f4574 ci: notify when a PR has a merge conflict.
Adds a "merge conflict" label and posts a comment when a PR has a merge
conflict. See https://github.com/Marr11317/ConflictAdviser#limitations.
2020-06-24 02:01:41 -05:00
evazion
85f58bf2f6 newgrounds: fix style nitpicks. 2020-06-24 00:25:45 -05:00
evazion
42c06b0f1e Merge pull request #4516 from nonamethanks/add_newgrounds_support
Add NewGrounds support
2020-06-24 00:20:16 -05:00
evazion
dfc7812abe Merge pull request #4518 from BrokenEagle/fix-pixiv-profile-url
Fix pixiv profile url
2020-06-24 00:07:18 -05:00
evazion
185693b99b Merge branch 'master' into fix-pixiv-profile-url 2020-06-24 00:06:55 -05:00
evazion
8ef2b7772d Merge pull request #4530 from BrokenEagle/parent-child-status-search
Add ability to search on status of parent/child
2020-06-23 23:53:57 -05:00
evazion
bb765f55d5 Eliminate misc dead code. 2020-06-23 23:37:56 -05:00
evazion
5f3c41416e tests: add more wiki page controller search tests. 2020-06-23 23:36:16 -05:00
evazion
2b969646bc tests: add respond_to_search test helper.
Add a `respond_to_search` test helper for concisely testing that a
controller's index action correctly responds to a search. Usage:

    # Tests that `/tags.json?search[name]=touhou` returns the `touhou` tag.

    setup { @touhou = create(:tag, name: "touhou") }
    should respond_to_search(name: "touhou").with { @touhou }
2020-06-23 23:35:48 -05:00
evazion
d71f3cbac1 Merge pull request #4531 from BrokenEagle/wiki-linked-to
Add option to search for wikis that don't link to a specific wiki
2020-06-23 23:21:16 -05:00
evazion
83a8468ee9 tests: remove unnecessary rescueing of Net::OpenTimeout errors.
These exceptions are no longer thrown now that we've switched from
HTTParty to http.rb. Swallowing unexpected exceptions during testing was
a bad practice anyway.
2020-06-23 03:12:44 -05:00
evazion
be4bdfc136 artists: add test for hiding deleted wikis on artist pages (#4526). 2020-06-23 03:01:32 -05:00
evazion
d1e0542eb5 Merge pull request #4534 from BrokenEagle/fix-4533
Fix the tag matches option
2020-06-23 03:00:32 -05:00
evazion
05fbbc69e6 Merge pull request #4529 from BrokenEagle/deleted-artist-wiki
Don't display artist wiki when it is deleted
2020-06-23 02:51:53 -05:00
evazion
0276792b35 BURs: add test for users voting on their own BURs (#4527) 2020-06-23 02:43:12 -05:00
evazion
da9c145c64 Merge pull request #4527 from BrokenEagle/forum-post-voting
Prevent creators from voting on their own BURs
2020-06-23 02:42:46 -05:00
evazion
8a21c9a8db Merge pull request #4523 from nonamethanks/revert_pixiv_tools
Revert "Pixiv: don't blacklist digital tools"
2020-06-23 02:39:18 -05:00
evazion
617211f405 Merge pull request #4521 from nonamethanks/zerochan_png
Zerochan: Normalize png links
2020-06-23 02:38:39 -05:00
evazion
73506bac33 twitter: add tests for uploading profile banners (#4520). 2020-06-23 02:37:21 -05:00
evazion
f2ae9eeae0 Merge pull request #4528 from nonamethanks/fix_4520
Twitter: don't get api without a status id
2020-06-23 02:36:32 -05:00
BrokenEagle
1a87935764 Fix the tag matches option
The split function was mistakenly used instead of the match function.
2020-06-23 06:58:03 +00:00
evazion
5dbe08372b nicoseiga: remove accept_fetish_warning.
This should have been a cookie, but it doesn't matter because the
strategy still works without it.
2020-06-23 00:49:38 -05:00
BrokenEagle
50740e302f Add option to search for wikis that don't link to a specific wiki
Also add inputs on the search page for both the linked_to and the
not_linked_to search parameters. Additionally, normalize the title
first since autocomplete adds trailing spaces. The search query was
also simplified a bit by taking advantage of Rails associations.
2020-06-23 05:31:43 +00:00
evazion
6ea2c934fd tests: temp skip failing danbooru::http redirect tests.
Skip for now until https://github.com/postmanlabs/httpbin/issues/617 is fixed.
2020-06-22 22:54:41 -05:00
evazion
7f5e87568a danbooru::http: raise exception on failed downloads.
Restore behavior from a6994cd4d, it breaks tests when they try to the
response body from a fake 599 response.
2020-06-22 22:51:36 -05:00
evazion
31802fb666 nijie: fix parallel test failures.
Nijie tests fail often under parallel testing. This is because every
test needs to login to Nijie first, but Nijie rate-limits the login
endpoint, so eventually we hit the limit and tests start failing.

This is made worse by a thundering herd problem. Eight test processes
try to login to Nijie at the same time, but only one succeeds, so the
rest sleep and try again, but they all wakeup and try again at the same
time, hitting the rate limits again.

The workaround is to set the retry limit ridiculously high, higher than
we would ideally like in production. Another workaround would be to
serialize the Nijie tests in the test suite. This can be done with
lockfiles and flock(2). This helps, but we can still hit the rate limit
even under serialized execution.
2020-06-22 22:21:17 -05:00
evazion
a6994cd4d7 media file: fix exception on empty files.
This may happen if a user uploads from a source that returns an error
HTTP response with no data.
2020-06-22 18:49:36 -05:00
evazion
8c6759bbd7 nicoseiga: fix login endpoint.
* Update the login endpoint. The old endpoint returns 404 now.

  POST https://account.nicovideo.jp/api/v1/login ->
  POST https://account.nicovideo.jp/login/redirector?site=seiga

* Let Danbooru::Http cache the login request instead of caching it manually.

* Let Danbooru::Http automatically follow redirects instead of dealing
  with the Location header manually.
2020-06-22 18:46:47 -05:00
evazion
95fee75d9a nicoseiga: fix uploads not working for certain direct image urls.
Fix Nicoseiga strategy to work with certain direct image urls that we
can't otherwise extract any information from.

Examples:

* https://dic.nicovideo.jp/oekaki/52833.png
2020-06-22 16:53:50 -05:00
evazion
db3407caa3 uploads: fix uploading from source not working.
ref: 26ad844bbe (r40077579).
2020-06-22 15:32:48 -05:00
evazion
b904c01d69 config: remove unused config files. 2020-06-21 19:01:12 -05:00
evazion
209350de5b scripts: remove unused danbooru-specific config.
Danbooru-specific configuration now lives in https://github.com/danbooru/danbooru-ansible.
2020-06-21 18:56:42 -05:00