Commit Graph
100 Commits
Author SHA1 Message Date
evazion 1a998cb3fb Move API methods from initializer to ApplicationRecord. 2017-06-16 13:28:31 -05:00
evazion c1834ab8dd Inherit models from ApplicationRecord instead of ActiveRecord::Base. 2017-06-16 13:28:31 -05:00
evazion 5c6eb0f475 posts: remove unused update_iqdb method.
Unused since 7aab50f.
2017-06-14 21:31:30 -05:00
evazion d84feaa4bb posts: fix expunging posts not removing image from iqdb.
`File.exists?(preview_file_path)` is always false because the file has
already been deleted by this point. Remove the check entirely.
2017-06-14 21:31:30 -05:00
evazion b27f98dc58 posts: fix expunging posts to delete files only after transaction succeeds. 2017-06-14 21:31:30 -05:00
evazion a844a1daf4 posts: fix expunging posts not deleting files.
Fix expungement to ignore the "file still in use" check.
2017-06-14 21:31:24 -05:00
evazion cdef9fda7d tests: fix send_message in post/pool archive helpers.
Since efe5e0e send_message is called with an extra param; fix mocked
send_message to handle this param.
2017-06-14 14:13:52 -05:00
evazion 155faf8380 commentaries: merge versions (fix #3149). 2017-06-14 13:52:24 -05:00
evazion 1ffc9d286c Fix User#can_view_flagger?. 2017-06-14 12:08:25 -05:00
evazion caebdef9fd commentaries: trim whitespace from existing commentaries. 2017-06-13 16:42:30 -05:00
evazion f8afabd51c commentaries: trim whitespace from fields. 2017-06-13 16:42:30 -05:00
evazion 1aafdc3928 commentaries: migrate columns to non-null. 2017-06-13 16:42:29 -05:00
evazion abb7117996 commentaries: add tests. 2017-06-13 15:13:53 -05:00
evazion 27aa9fe82a post replacements: don't delete files still in use.
Bug: if a user replaces a post with another image, then replaces the
post back to the original image, then the deletion job for the original
image will still run. The will delete the original file, but that file
is now in use again and should not be deleted.
2017-06-13 02:20:23 -05:00
evazion a1c9f34027 Fix #1908: Allow E shortcut to work on upload page. 2017-06-12 20:28:56 -05:00
evazion c06ae5277e Fix #1608: Show wiki page of alias consequent for Related Tags
Make related tags apply aliases before fetching tags from the wiki page.
2017-06-12 19:52:19 -05:00
evazion 1f2840917f /post_versions: fix taglist to wordbreak between tags. 2017-06-11 13:48:13 -05:00
evazion f3f55daea6 Fix #3138: Support DeviantArt login-only works. 2017-06-10 10:34:51 -05:00
evazion 5f9fce7343 Fix #3139: XSS in Related Tags javascript. 2017-06-09 20:40:07 -05:00
evazion 82c7537270 deviantart: force commentary encoding to utf-8. 2017-06-09 13:19:24 -05:00
evazion 2fcd823eff deviantart: add source tests. 2017-06-09 13:19:24 -05:00
evazion ccacfb40be deviantart: translate artist commentary from html to dtext. 2017-06-09 13:19:24 -05:00
evazion 42aed84975 /posts/$id: fix artcomm dialog to use dtext-ified commentary. 2017-06-09 12:29:04 -05:00
evazion 9234fa7885 post replacement: allow replacing ugoiras. 2017-06-08 23:54:51 -05:00
evazion ec9a3e5c17 posts: add partial indexes on is_pending, is_flagged. 2017-06-08 00:00:38 -05:00
evazion 2929857682 blacklists: fix inline blacklist css to work on any page. 2017-06-07 23:31:34 -05:00
evazion 5c9b5cd21e blacklists: add missing blacklist controls on several pages (fix #3121). 2017-06-07 23:30:35 -05:00
evazion 23fb6b8d15 /users/$id.json: fix exception when pool archives is disabled (fix #3123). 2017-06-07 22:54:16 -05:00
evazion 58bd0670b7 Post#pools: avoid query when post has no pools. 2017-06-07 22:45:28 -05:00
evazion 151b276fb9 modqueue: display pools for each post (fix #3125). 2017-06-07 22:45:01 -05:00
evazion 12fffc3760 modqueue: factor out modqueue posts into partial. 2017-06-07 22:44:46 -05:00
evazion 39bd141667 artstation: fix fetch source data for image urls.
Fixes 'Fetch source data' when uploading an image url and the referer
url is available:

* https://danbooru.donmai.us/uploads/new?url=https://cdna.artstation.com/p/assets/images/images/006/029/978/large/amama-l-z.jpg&ref=https://www.artstation.com/artwork/4BWW2
2017-06-07 10:20:18 -05:00
evazion edd02c4019 artstation: normalize to www.artstation.com/artwork/$id for sidebar. 2017-06-07 10:20:18 -05:00
evazion b1171306a1 artstation: include only images in image_urls. 2017-06-07 10:20:18 -05:00
evazion 215569fbe0 artstation: fix source to page url after download. 2017-06-07 10:20:17 -05:00
evazion a68ff3c347 artstation: accept www.artstation.com/artwork/foo-bar-baz style urls. 2017-06-07 10:20:17 -05:00
evazion fed23c0baa fetch source data: fix gallery warning for non-pixiv galleries. 2017-06-06 23:03:07 -05:00
evazion 047fb68f45 Fix #3117: Nicoseiga handler grabbing wrong commentary source
* `summary` is the wrong field. It's the list of comments left by users,
  not the artist's commentary.

* For some reason `doc.response.image.description` returns nil even
  though the description element exists. Switch to `Hash.from_xml` to
  avoid this.
2017-06-06 13:44:43 -05:00
evazion b3e533f3ff Add download rewrite for https://$artist.artstation.com/projects/$id. 2017-06-05 14:03:51 -05:00
evazion 71950597e8 Add source tests for https://$artist.artstation.com/projects/$id. 2017-06-05 14:03:50 -05:00
evazion 666aaef69c Add source support for https://$artist.artstation.com/projects/$id. 2017-06-05 14:03:38 -05:00
evazion 1d62ea3220 /forum_topics: don't list stickies first in json/atom responses. 2017-06-04 16:14:55 -05:00
evazion 9b31e16627 mode menu: fix height of tag edit box in edit mode.
Bug: in edit mode, each time you click a thumbnail the height of the tag
edit box increases by 4px.

This is due to `scrollHeight` including vertical padding. Fix it to a)
ignore this padding, and b) ensure the min height is at least 80px.
2017-06-04 14:02:46 -05:00
evazion fdf8e7d5d7 Fix mode menu 'approve' option.
* Fix routing error in respond_with (didn't use /moderator namespace).

* Fix /moderator/posts/approvals.json response to return full
  PostApproval object, not just a success/failure message.

* Simplify the javascript a bit (use $.post instead of $.ajax).
2017-06-04 12:14:35 -05:00
evazion 4fe97a8218 Hide the flags and appeals notices after approving post. 2017-06-04 10:07:42 -05:00
evazion 3880fbe13e /posts/$id: fix shift+O to approve shortcut.
`Danbooru.Post.approve` is used for approving posts via the mode menu.
It doesn't hide all the notices or the approve/disapprove/flag buttons.
Click the link instead to hide those things.

Click the #quick-mod-approve link instead of #approve because #approve
prompts for confirmation.
2017-06-04 10:07:26 -05:00
evazion 6699e9d66f Fix autocomplete on intro page (fix #3109). 2017-06-04 08:43:51 -05:00
evazion 7d8150ae2d /post_versions, /artist_versions: fix missing spaces between tags/names. 2017-05-31 19:48:42 -05:00
evazion cebf29f83e Allow escaping wildcards (\*) in wildcard searches. 2017-05-31 16:15:18 -05:00
evazion 88d14b30ed mass updates: log modaction after update successfully completes. 2017-05-28 11:56:44 -05:00
evazion c1a8800bf8 mass updates: fix exception when moving saved searches. 2017-05-28 11:55:05 -05:00
evazion 31b58e17b1 pools: lock pool when adding/removing posts (fixes #3091).
Adding a post id to a pool's post_ids string is non-atomic, hence we
must lock the pool to avoid a race condition.

Adding a pool to a post's pool_string is likewise non-atomic, hence we
must lock the post as well.
2017-05-26 18:35:33 -05:00
evazion a401b1f570 posts: fix nil source tests; fix source:none metatag. 2017-05-26 15:12:39 -05:00
evazion 8f98e8e03c posts: redefine source column to be non-NULL (fixes #3090). 2017-05-26 13:54:17 -05:00
evazion 3ecee91861 Fix #3061: Add "General" button for related tags on new/edit posts. 2017-05-26 12:49:59 -05:00
evazion 991d5cbf6d related tags: optimize calculate_from_sample.
calculate_from_sample is called when clicking the General / Artist /
Copyright / Characters buttons during tag editing. Currently it's slow
because it counts up the tags in ruby, and because it makes repeated
calls to memcache in the inner loop when filtering tags by category.

This changes it to do the counting and filtering entirely in SQL using a
GROUP BY tag / COUNT(*) aggregation. This is faster and makes larger
sample sizes more feasible.
2017-05-26 12:41:48 -05:00
evazion 1b03832b26 /forum_topics/$id: fix atom feed discovery link.
> Found an issue with the forum topic ATOM discovery link. Currently the
> link is visible to feed detectors, but they are unable to add it since
> the link provided is invalid.
>
> <link rel="alternate" type="application/atom+xml" title="Artist tagging
> help" href="http://danbooru.donmai.us/forum_topics.8199" />
2017-05-24 16:11:00 -05:00
evazion ea80d51ecf /posts/$id: add feed discovery link for comments on post. 2017-05-24 16:10:56 -05:00
evazion 1a52f9db2b wiki pages: add wildcard support to "other names" search. 2017-05-24 14:59:00 -05:00
evazion 614bf44086 /bulk_update_requests: add search form. 2017-05-23 17:23:32 -05:00
evazion 02b3622f12 api: allow search[*_id] params to accept lists of ids in more places. 2017-05-23 15:45:40 -05:00
evazion 8988f9cde8 /forum_topics.json: add search[id]=<ids> param. 2017-05-23 15:27:15 -05:00
evazion 3aa405eac1 Post#favorited_by?: fix to cast to a boolean. 2017-05-23 13:12:10 -05:00
evazion 05c6716def Fix date:, age: metatags to use the index. (fix #672). 2017-05-23 12:59:08 -05:00
evazion 4c61e547b9 posts: add data-is-favorited attribute to thumbnails. 2017-05-23 11:53:04 -05:00
evazion c5de983f61 Post#favorited_by?: fix to return a boolean. 2017-05-23 11:53:03 -05:00
evazion 9cf2c60c09 /wiki_page_versions: add #p-global-listing, #p-page-listing ids.
Split the wiki page versions template into two partials,
_global_listing.html.erb and _page_listing.html.erb, to avoid the nested
conditionals that arise from combining these two pages into one template.

Add html IDs to distinguish between these two partials.
2017-05-22 14:05:30 -05:00
evazion 5ff4f12329 /moderator/ip_addrs: add #p-ip-listing, #p-user-listing ids. 2017-05-22 13:25:36 -05:00
evazion 52e289e990 /static/terms_of_service: fix page wrapper ids. 2017-05-22 13:19:18 -05:00
evazion 8bf03e596d /user_reverts/new: fix page wrapper id. 2017-05-22 13:09:52 -05:00
evazion 060375dce7 /bans/new: fix page wrapper ids. 2017-05-22 13:09:36 -05:00
evazion d5b9b7162c /user_upgrades/new: fix page wrapper id.
* Move related css to user_upgrades.scss.
* Delete users/upgrade_information.html.erb as it is unused.
2017-05-22 13:07:31 -05:00
evazion c31d11b095 bans: fix case sensitivity bug in ban reason search. 2017-05-21 20:13:43 -05:00
evazion 3f760069b3 dmails: fix case sensitivity bug in dmail title search. 2017-05-21 13:52:56 -05:00
evazion 9b613157ae Add data attributes for CurrentUser's privileges to <body> tag (fix #3073). 2017-05-21 12:31:28 -05:00
evazion f1f6e5ccc9 anonymous_user.rb: generate is_<role>? methods from User::Roles. 2017-05-21 12:27:39 -05:00
evazion 76b50c31bf /forum_topics/$id.atom: fix ordering (fix #3069). 2017-05-21 10:31:21 -05:00
evazion 223e600eb0 /explore/posts/{popular,searches,missed_searches}: fix page wrapper ids. 2017-05-21 10:26:03 -05:00
evazion 86b1298662 /reports/upload_tags: change page wrapper id to #c-upload-tags-report. 2017-05-20 12:09:37 -05:00
evazion 9bf85ee2b3 Factor out <ins>/<del> css from #c-post-versions to .diff-list. 2017-05-20 12:07:47 -05:00
evazion 6475b98c46 /posts/$id/events: change page wrapper id to #c-post-events. 2017-05-20 08:09:54 -05:00
evazion fad4d48b1c search: fix order:note, order:comment_bumped to use indexes. 2017-05-19 18:19:05 -05:00
evazion d74eda2b96 search: readd posts.id secondary sort to order: metatags. 2017-05-19 18:19:04 -05:00
evazion a8c1b0bc62 structure.sql: add forum topics (is_sticky, updated_at) index. 2017-05-19 18:19:04 -05:00
evazion 2259506bc2 flags: disallow flagging pending posts. 2017-05-19 14:37:38 -05:00
evazion 0e26d0e77e /pool_versions: change page wrapper id to #c-pool-versions. 2017-05-19 13:55:30 -05:00
evazion d46aa89159 /wiki_page_versions: change page wrapper id to #c-wiki-page-versions.
Changes the wrapper id to #c-wiki-page-versions and moves the
corresponding css from wiki_pages.scss to wiki_page_versions.scss.
2017-05-19 13:40:24 -05:00
evazion 3570ace017 flags: ignore flagging rate-limits when deleting posts. 2017-05-17 23:48:37 -05:00
evazion 565945ab7b flags: move flagging inside Post#delete! 2017-05-17 23:48:37 -05:00
evazion 9f1096e67f post replacement: rescale notes. 2017-05-17 00:14:41 -05:00
evazion 302bc52bf8 post replacement: take guidelines from help:replacement_notice. 2017-05-17 00:14:41 -05:00
evazion 402caf6168 post replacement: don't send @mention dmails to replacer. 2017-05-17 00:14:41 -05:00
evazion a3db5ba346 post replacement: move presenter methods to post_replacement.rb. 2017-05-17 00:14:41 -05:00
evazion cd3914f17c post replacement: move tests to post_replacement_test.rb. 2017-05-17 00:14:41 -05:00
evazion eac827973b Normalize pixiv artist urls to pixiv member page (fix #3048). 2017-05-15 14:12:08 -05:00
evazion 6ee3b2635a Fix returning incorrect pixiv profile url (fixes #3054). 2017-05-14 22:00:06 -05:00
evazion 9b73823ccd Add post replacement create action test. 2017-05-14 21:31:12 -05:00
evazion 648cc9ecb7 Move post replacement create action to post replacements controller. 2017-05-14 21:31:01 -05:00
evazion cb09b6661d Add /post_replacements.json, /posts/1234/replacements.json. 2017-05-14 18:49:57 -05:00
evazion a6737dfc14 daily_maintenance.rb: don't prune file deletion delayed jobs. 2017-05-14 12:49:11 -05:00