Commit Graph

8176 Commits

Author SHA1 Message Date
evazion
a5ef86bbe8 views: add html ids for main menu and subnav menu.
Also refactor secondary links to put the <menu> element in the default
layout instead of in each _secondary_links partial.
2019-09-17 00:28:41 -05:00
evazion
c85bbbf8c2 comments: fixup "show hidden comments" link.
Fixup for 896f144eb.
2019-09-17 00:28:40 -05:00
evazion
793c07341d Fix #4163: Remove reversion links outside of the proper context. 2019-09-12 22:37:32 -05:00
evazion
f8dd3eb72b Fix #4165: Add mechanism to test error responses.
https://danbooru.donmai.us/posts.json?error=500&message=testing
2019-09-12 22:37:32 -05:00
evazion
4915690c6d Fix #4166: Some metatags incorrectly showing tag results. 2019-09-12 22:37:32 -05:00
evazion
637e961f0a Fix #4167: Add more IDs to side menu elements. 2019-09-11 03:19:49 -05:00
evazion
a5043245b6 views: migrate related tags, mass edits to simple form. 2019-09-10 21:51:14 -05:00
evazion
896f144eb6 views: refactor quick search forms. 2019-09-10 21:10:09 -05:00
evazion
ffccc503f7 views: removed unused helpers. 2019-09-10 15:21:48 -05:00
evazion
372fd7df1b /pool_versions: fix exception in pool diffs.
https://danbooru.donmai.us/forum_topics/9127?page=280#forum_post_159633
2019-09-10 15:13:06 -05:00
evazion
e815f46d2a /meta_searches/tags: fix tag_alias_correction_path reference.
Tag alias corrections were removed in #4130. Fixes exception on /meta_searches/tags.
2019-09-10 14:59:27 -05:00
evazion
a1b48f5e3f views: migrate search forms to use simple form.
Migrate various forms to be built using simple form instead of raw html.
Also adds autocomplete="off" to these forms (#4162).
2019-09-10 14:33:18 -05:00
evazion
1743f3797f views: factor out search_form_for helper.
Refactor search forms to use `search_form_for` so that we can set common
options on all search forms, such as autocomplete="off" (#4162).
2019-09-10 14:31:19 -05:00
evazion
49d38d6256 views: fix positioning of form hints.
Position <span class="hint"> elements to the right of normal <input>
elements and underneath <textarea> elements. Fixes form hints being
badly positioned on some pages.
2019-09-10 14:30:49 -05:00
evazion
347aa4b835 Add error pages for tag limit and pagination errors. 2019-09-09 17:43:30 -05:00
evazion
62b89e1f9a user upgrades: make upgrade page visible to logged out users. 2019-09-09 17:42:46 -05:00
evazion
93256c3ab2 Fix broken TagSubscription migration.
Disable old migration because TagSubscription model no longer exists
(should have been a fix script instead of a migration).
2019-09-09 17:03:28 -05:00
evazion
059e061b15 tests: fixup comment vote, post controller tests.
Use git clean to delete stale files from an earlier checkout. These
files interfered with various things (specifically, a comment vote test
failed because there was an old comment_votes/create.json.erb template
hanging around that changed the behavior of the POST /comment_votes endpoint).
2019-09-09 15:06:24 -05:00
evazion
d812a19902 tests: fixup tests. 2019-09-09 11:51:01 -05:00
evazion
efca48ee96 Set SameSite=Lax on session cookies.
https://web.dev/samesite-cookies-explained
2019-09-09 11:51:01 -05:00
evazion
312606bf98 Fix #4137: Share cookies across subdomains 2019-09-09 11:51:01 -05:00
evazion
6595a9f87e users: raise max posts per page to 200. 2019-09-08 23:34:49 -05:00
evazion
8198c610cc /pool_versions: add '»' drilldown links.
Add '»' drilldown links for pool names, users, and post ids.
2019-09-08 23:28:02 -05:00
evazion
964a073ec3 Fix #4159: Add pool history to post show pages. 2019-09-08 23:28:02 -05:00
evazion
b202985eaa posts/show: make post history pages visible to all. 2019-09-08 23:28:02 -05:00
evazion
5729d92c8e posts/show: make 'download', 'find similar' links visible to all. 2019-09-08 23:28:02 -05:00
evazion
763ac1a7e0 pools: stop maintaining pool category pseudotags in pool strings (#4160)
Stop maintaining pool category pseudo tags (pool:series, pool:collection)
in pool strings. They're no longer used and the changes to the
`Post#pools` method in dc4d2e54b caused issues with this.

Also allow Members to change the category of large pools again. This was
only restricted because maintaining these pseudotags forced us to update
every post in the pool whenever a pool's category was changed.
2019-09-08 23:28:02 -05:00
evazion
d0f060d8eb api: refactor api attribute declarations.
Replace the `method_attributes` and `hidden_attributes` methods with
`api_attributes`. `api_attributes` can be used as a class macro:

    # include only the given attributes.
    api_attributes :id, :created_at, :creator_name, ...

    # include all default attributes plus the `creator_name` method.
    api_attributes including: [:creator_name]

or as an instance method:

    def api_attributes
       [:id, :created_at, :creator_name, ...]
    end

By default, all attributes are included except for IP addresses and
tsvector columns.
2019-09-08 23:28:02 -05:00
evazion
19f2cc1e74 api: refactor only param. 2019-09-08 23:28:02 -05:00
evazion
24202d51f0 api: support the expires_in param on all GET requests.
`expires_in` is an alternative to `expiry` that supports durations other
than days:

* https://danbooru.donmai.us/posts.json?expires_in=30s
* https://danbooru.donmai.us/posts.json?expires_in=5min
* https://danbooru.donmai.us/posts.json?expires_in=1hour
* https://danbooru.donmai.us/posts.json?expires_in=1week
* https://danbooru.donmai.us/posts.json?expires_in=1month
2019-09-08 15:32:31 -05:00
evazion
22fd90eee9 api: support the expiry param on all GET requests. 2019-09-08 15:32:31 -05:00
evazion
3f7e05316d api: refactor default options for xml responses.
In xml responses, if the result is an empty array we want the response
to look like this:

   <posts type="array"/>

not like this (the default):

   <nil-classes type="array"/>

This refactors controllers so that this is done automatically instead of
having to manually call `@things.to_xml(root: "things")` everywhere. We
do this by overriding the behavior of `respond_with` in `ApplicationResponder`
to set the `root` option by default in xml responses.
2019-09-08 15:32:31 -05:00
evazion
32343303d2 forum posts: raise privilege error when viewing restricted topics.
Raise a privilege error when trying to view a restricted topic instead
of handling it in the controller. This way error handling is standardized.
2019-09-08 15:32:31 -05:00
evazion
31c7386b9e posts: fixup set_pool_category_pseudo_tags on new posts.
Calling set_pool_category_pseudo_tags before saving the post doesn't
work on new posts because they don't have an id yet, so trying to get
the pools by post id in `Post#pools` fails.
2019-09-08 15:32:31 -05:00
evazion
dc4d2e54b2 pools: stop using the pool_string field (#4160).
Stop using the pool_string field internally, but keep maintaining it
until we can drop it later.

* Stop using the pool_string for `pool:<name>` metatag searches.
* Stop using the pool_string in the `Post#pools` method. This is used to
  get the list of pools on post show pages.
2019-09-08 00:11:57 -05:00
evazion
3bd8a5c4e3 pools: add post_ids, is_deleted, category indexes. 2019-09-07 23:06:20 -05:00
evazion
57a61ca586 posts/show: avoid extra queries when rendering pool list. 2019-09-07 22:30:04 -05:00
evazion
37e48844fd Update gems. 2019-09-07 22:25:38 -05:00
evazion
258fa06422 tests: replace workoff_active_jobs with perform_enqueued_jobs. 2019-09-07 22:21:55 -05:00
evazion
6b8515811f tags: drop related_tags column. 2019-09-07 22:21:55 -05:00
evazion
4fc1e16731 pools: add more name validations.
These validations should never fail because normalize_name strips
leading/trailing underscores, consecutive underscores, and unicode
whitespace.
2019-09-07 22:10:25 -05:00
evazion
1852b821f8 autocomplete: don't return deleted pools. 2019-09-07 22:10:25 -05:00
evazion
886ee16911 pools: allow searching pools by post tags.
Find all pools containing at least one post tagged 'translated':

    https://danbooru.donmai.us/pools?search[post_tags_match]=translated
2019-09-06 17:54:07 -05:00
evazion
a9b7503aa7 pools: allow searching pools by post id or post count.
All pools containing post #1:

    https://danbooru.donmai.us/pools?search[post_ids_include]=1

All pools containing either post #1 or #2:

    https://danbooru.donmai.us/pools?search[post_ids_include]=1,2
    https://danbooru.donmai.us/pools?search[post_ids_include]=1+2

Pools with 1-100 posts:

    https://danbooru.donmai.us/pools?search[post_id_count]=1..100

Pools with no posts (empty pools):

    https://danbooru.donmai.us/pools?search[post_id_count]=0
2019-09-06 16:18:29 -05:00
evazion
7d07b5f289 artist: drop unused member_names method. 2019-09-06 16:18:29 -05:00
evazion
4fb24c812f Fix #4155: Fix profile/settings metadata discrepancy. 2019-09-05 00:14:11 -05:00
evazion
3af352c76a Fix #4154: Saved searches can be cached indefinitely. 2019-09-05 00:08:00 -05:00
evazion
fc3b822bdf artists: reduce queries in artist summaries.
Avoid a few queries when searching for single artist tags.
2019-09-05 00:00:15 -05:00
evazion
416f817f6d Post.fast_count: fix incorrect counts for aliased tags.
Revert optimization from a6163258b. Turns out that we have to resolve
aliases in fast_count, otherwise for aliased tags we'll return an empty
count.

Fixes #4156.
2019-09-04 23:56:12 -05:00
evazion
59d92b448e /artists: remove /artists/new from navbar for anon users.
Fixes the logs being flooded with 403 errors because of bots and logged
out users trying to access the new artist page.
2019-09-04 16:42:24 -05:00