Commit Graph

47 Commits

Author SHA1 Message Date
evazion
b002bf25f5 autocomplete: display autocorrected tags like aliases.
Display autocorrected tags similar to aliases, with an arrow pointing at
the corrected tag, but with a dotted underline beneath the misspelled
tag to indicate that it's misspelled.
2020-12-13 04:10:48 -06:00
evazion
adc1c2c2cc autocomplete: refactor javascript to use /autocomplete endpoint.
This refactors the autocomplete Javascript to use a single dedicated
/autocomplete.json endpoint instead of a bunch of separate endpoints.

This simplifies the autocomplete Javascript by making it so that instead
of calling a different endpoint for each type of query (for users, wiki
pages, pools, artists, etc), then having to parse the results of each
call to get the data we need, we can call a single endpoint that returns
exactly what we need.

This also means we don't have to parse searches clientside in order to
autocomplete metatags. Instead we can just pass the search term to the
server and let it parse the search, which is easy to do serverside.

Finally, this makes autocomplete easier to test, and it makes it easier
to add more sophisticated autocomplete behavior, since most of the logic
lives serverside.
2020-12-13 00:45:22 -06:00
evazion
06564b25ca autocomplete: add status:appealed to autocomplete. 2020-08-12 22:40:17 -05:00
evazion
d7f489b68e users: get rid of the .with-style class.
Replace with `body[data-current-user-style-usernames="true"]` instead.
2020-07-13 17:08:53 -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
BrokenEagle
4acd89838b Add ability to search on status of parent/child 2020-06-21 22:39:21 +00:00
evazion
e425870c17 Fix #4027: Search for posts favorited by the fav group order. 2020-04-27 13:11:07 -05:00
evazion
e848011080 Fix #4406: Add "commentary:" metasearch.
Add:

* commentary:true (posts with commentary)
* commentary:false (posts without commentary)
* commentary:translated (posts with translated commentary)
* commentary:untranslated (posts with untranslated commentary)
* commentary:"text" (posts where any commentary field matches "text")

Known issues:

* There's no way to escape the true, false, translated, or
  untranslated keywords to do a literal text search for commentaries
  containing one of these keywords.

* Negated searches may be slow. Using a left outer join instead of a
  subquery would be faster in most cases, but negating it is harder.
2020-04-17 00:11:00 -05:00
evazion
9901161bbf search: rename artcomm metatag to commentaryupdater.
* Rename the artcomm:<user> metatag to commentaryupdater:<user>.
* Add support for negated -commentaryupdater:<user> searches.
2020-04-16 21:06:51 -05:00
evazion
fde42022c0 post disapprovals: refactor disapproval reasons.
* Factor out reasons into a constant
* Change column default and eliminate unused `legacy` reason.
2020-04-03 23:44:02 -05:00
evazion
967d398c8e search: move query parsing code from tag model to post query builder. 2020-03-06 23:23:38 -06:00
evazion
4c11e339bd artists: rename is_active flag to is_deleted.
Rename is_active to is_deleted. This is for better consistency with
other models, and to reduce confusion over what "active" means for
artists. Sometimes users think active is for whether the artist is
actively producing work.
2020-03-06 14:50:21 -06:00
evazion
b232470248 search: change behavior of disapproval:<reason> metatag.
* Change the `disapproval:<reason>` metatag to `disapproved:<reason>`.

* Change `disapproved:<reason>` to show all posts disapproved for a
  given reason, not just those disapproved by the current user.

* Allow searching for your own disapprovals with `disapproved:<my_name>`.

* Drop the `disapproved:<any|none>` metatags. `disapproved:any` is
  equivalent to `disapproved:<my_name>` and `disapproved:none` is
  equivalent to `-disapproved:<my_name>`.

These changes are so that you can search e.g. disapproved:poor_quality
to find all posts disapproved for poor quality.
2020-02-29 17:46:57 -06:00
BrokenEagle
e4ff641c9a Fix autocomplete insert completion
It was removing line returns, even when line returns are important,
such as in the blacklist and frequent tags input fields. Besides those,
it was also causing confusion when editing tags on a post, as those
are divided into categories, but adding an additional tag for a category
at the end of a group causes groups of tags to be combined.
2020-02-18 00:00:58 +00:00
BrokenEagle
d9e5b94838 Added search for posts with the embedded flag enabled 2020-01-23 03:30:38 +00:00
evazion
9d71c77524 autocomplete: fix favgroup:<name> returning favgroups for other users.
* Fix favgroup:<name> autocompletion to only return favgroups for the
  current user.
* Add favgroup autocomplete to the /favorite_groups search form.
2020-01-22 11:21:16 -06:00
evazion
0a3d038df9 autocomplete: fix broken wiki page autocomplete.
Fix breakage from 34368272e.
2020-01-21 18:44:02 -06:00
evazion
378559ff47 autocomplete: make number of results configurable (partly).
Add `Danbooru.Autocomplete.MAX_RESULTS` param that controls the number
of results returned by autocomplete.

This does not work with tag autocomplete for Builders. Builder
autocomplete still needs to be refactored and unified with Member
autocomplete.

Also fix a bug in the /saved_searches/labels endpoint where the limit
param wasn't respected.
2019-11-13 01:47:41 -06:00
evazion
89c5ac73af autocomplete: switch to async/await. 2019-11-13 01:47:41 -06:00
evazion
2d1eabbe5f autocomplete: factor out clearing of menu bindings. 2019-11-13 01:47:37 -06:00
evazion
f9881e5414 autocomplete: add saved search label autocomplete in more places. 2019-11-12 20:24:24 -06:00
evazion
75ca53a9a1 autocomplete: fix underscore-to-space conversion in usernames.
Didn't handle names with multiple underscores correctly.
2019-11-04 15:45:07 -06:00
evazion
d64236813a js: replace <meta> tags with <body> data attributes.
Refactor things to store information about the current user as data
attributes on the <body> tag rather than as <meta> tags. These <meta>
tags are now deprecated and will be eventually removed.

* Store all of the current user's API attributes as data attributes on
  the <body> tag.

* Add `CurrentUser.data` for getting data from the <body> tag, and
  use it instead of `Utility.meta`.

* Add `CurrentUser.update` for updating the current user's settings.

* Fix a bug with the user named "Anonymous" not being able to edit notes.
2019-10-02 15:59:22 -05:00
evazion
e96d3cba78 autocomplete: fix autocomplete triggering after blank space. 2019-09-23 22:30:56 -05:00
evazion
79c22b8d50 Fix #4174: Don't allow invalid prefix combinations for autocomplete.
* Autocorrect duplicated operators (e.g. complete `--tag` as `-tag`).
* Don't accept invalid metatag + prefix combinations (e.g. don't
  complete `char:rating:s` as `rating:safe`).
2019-09-22 18:58:12 -05:00
evazion
4dfa645550 Fix #4169: Tag operators not working with autocomplete. 2019-09-17 13:48:09 -05:00
evazion
4915690c6d Fix #4166: Some metatags incorrectly showing tag results. 2019-09-12 22:37:32 -05:00
evazion
1852b821f8 autocomplete: don't return deleted pools. 2019-09-07 22:10:25 -05:00
evazion
f2937e3d27 js: update yarn packages. 2019-08-18 11:24:42 -05:00
evazion
fa19047220 autocomplete: add username autocompletion sitewide. 2019-08-11 15:38:39 -05:00
evazion
957d1527d1 autocomplete: add order:*_count metatags. 2018-12-11 18:10:20 -06:00
evazion
cacc899a4d autocomplete: limit static metatags to 10 matches.
Prevents autocomplete menu from becoming excessively long when
completing order: metatags.
2018-12-11 12:02:18 -06:00
Albert Yi
3fbe1629e0 remove delete-on-autocomplete functionality 2018-10-15 14:21:19 -07:00
evazion
f917b83d6f /artists: drop deprecated search syntax, add regex search for names.
Drop support for the following pseudo-metatags in the Name field in the
artists search form:

* name:<name>
* other:<other name>
* group:<group name>
* status:banned
* status:active
* http://www.example.com

Instead, make the Name field do a wildcard search against the artist
name, group name, or other names. If the query looks like `/regex/`,
then do a regex search against any of these names.

/artists?search[name] now does a literal exact match and
/artists?search{any_name_matches] does the above wildcard/regex search.
2018-09-21 20:51:53 -05:00
evazion
29cdaddd86 PostSetPresenters::Post#related_posts: clean up metatag parsing (#2894).
* Fix `#related_tags` to use `Tag.has_metatag?`.
* Fix Tag::SUBQUERY_METATAGS and Tag::METATAGS to be arrays instead of regexes.
2018-09-20 19:23:47 -05:00
evazion
823f78af49 autocomplete.js: add data attrs on autocomplete results (#3902). 2018-09-17 18:18:33 -05:00
evazion
3bed5f3cf9 Fix #3867: Add namespaces to all Javascript events. 2018-09-04 12:26:18 -05:00
Albert Yi
66e413b540 Adds fuzzy string matching and prefix matching 2018-08-28 16:41:52 -07:00
evazion
4f02c7f70a search: add status:modqueue, status:unmoderated metatags.
* status:modqueue = ~status:pending ~status:flagged
* status:unmoderated = status:modqueue -user:self -approver:self -disapproval:any
2018-08-23 14:48:39 -05:00
evazion
89c4fe150a search: add disapproval:<any|none|disinterest|poor_quality|breaks_rules> metatag. 2018-08-23 14:08:02 -05:00
Albert Yi
62027e8771 remove unused js var 2018-08-06 10:43:26 -07:00
Albert Yi
fd8568c726 Merge branch 'master' into feat-eslint 2018-08-06 10:27:32 -07:00
Albert Yi
3672eedd36 expose additional js modules (#3795) 2018-08-06 10:13:11 -07:00
evazion
f72b32b27b Fix eslint warnings. 2018-08-05 18:30:25 -05:00
Albert Yi
cffb08a4b6 add global hooks for autocomplete functions #3795 2018-08-03 16:02:47 -07:00
Albert Yi
cdb0a2cac7 remove unused export 2018-08-01 16:12:22 -07:00
Albert Yi
6fa0ae2cf1 Migrate assets to use Webpacker 2018-07-27 15:24:05 -07:00