Commit Graph

109 Commits

Author SHA1 Message Date
nonamethanks
ca31e7a47c Users: add Contributor and Approver user levels 2022-10-21 20:52:31 +02:00
evazion
88be28ae36 users: optimize commented/noted post count on user profiles.
Count the number of commented and noted posts directly, instead of
indirectly by counting the number of posts in a `commenter:<name>` or
`noteupdater:<name>` search. This is faster because it generates
better SQL.
2022-04-06 00:18:29 -05:00
evazion
6edff247f2 search: replace calls to PostQueryBuilder#fast_count with PostQuery#fast_count.
Prepare a few more places for the new tag search parser.
2022-03-30 01:37:11 -05:00
evazion
a7dc05ce63 Enable frozen string literals.
Make all string literals immutable by default.
2021-12-14 21:33:27 -06:00
evazion
90a4ac3bf5 users: reword ban notice messages.
* Show the ban length instead of the ban expiration date in ban notices.
* Fix the ban notice to not say "Your account has been temporarily
  banned" when it's a permanent ban.
2021-05-15 04:36:22 -05:00
evazion
8ca757244a users: rename recent_ban to active_ban. 2021-05-15 04:36:22 -05:00
nonamethanks
ce86f6d274 User profiles: use name instead of id in links to post edits 2021-03-12 03:10:44 +01:00
evazion
99e88b3dae seo: add rel=nofollow to various internal search links.
Add rel=nofollow to various internal search links to prevent Google from
attempting to crawl things like `<tag> status:deleted` or `approver:<name>`
searches.
2020-07-03 15:58:59 -05:00
evazion
ad02e0f62c posts/index: fix rating:s being included in page title in safe mode.
Fixes bug described in d3e4ac7c17 (commitcomment-39049351)

When dealing with searches, there are several variables we have to keep
in mind:

* Whether tag aliases should be applied.
* Whether search terms should be sorted.
* Whether the rating:s and -status:deleted metatags should be added by
  safe mode and the hide deleted posts setting.

Which of these things we need to do depends on the context:

* We want to apply aliases when actually doing the search, calculating
  the count, looking up the wiki excerpt, recording missed/popular
  searches in Reportbooru, and calculating related tags for the sidebar,
  but not when displaying the raw search as typed by the user (for
  example, in the page title or in the tag search box).
* We want to sort the search when calculating cache keys for fast_count
  or related tags, and when recording missed/popular searches, but not
  in the page title or when displaying the raw search.
* We want to add rating:s and -status:deleted when performing the
  search, calculating the count, or recording missed/popular searches,
  but not when calculating related tags for the sidebar, or when
  displaying the page title or raw search.

Here we introduce normalized_query and try to use it in contexts where
query normalization is necessary. When to use the normalized query
versus the raw unnormalized query is still subtle and prone to error.
2020-05-12 21:47:00 -05:00
evazion
f38c38f26e search: split tag_match into user_tag_match / system_tag_match.
When doing a tag search, we have to be careful about which user we're
running the search as because the results depend on the current user.
Specifically, things like private favorites, private favorite groups,
post votes, saved searches, and flagger names depend on the user's
permissions, and whether non-safe or deleted posts are filtered out
depend on whether the user has safe mode on or the hide deleted posts
setting enabled.

* Refactor internal searches to explicitly state whether they're
  running as the system user (DanbooruBot) or as the current user.
* Explicitly pass in the current user to PostQueryBuilder instead of
  implicitly relying on the CurrentUser global.
* Get rid of CurrentUser.admin_mode? (used to ignore the hide deleted
  post setting) and CurrentUser.without_safe_mode (used to ignore safe
  mode).
* Change the /counts/posts.json endpoint to ignore safe mode and the
  hide deleted posts settings when counting posts.
* Fix searches not correctly overriding the hide deleted posts setting
  when multiple status: metatags were used (e.g. `status:banned status:active`)
* Fix fast_count not respecting the hide deleted posts setting when the
  status:banned metatag was used.
2020-05-07 03:29:44 -05:00
evazion
a753ebbea9 posts: move fast_count to PostQueryBuilder. 2020-05-07 03:29:38 -05:00
evazion
6b1d73ddae user name changes: fix permission inconsistencies.
* Let moderators see name changes for deleted users on the user name
  change requests index and show pages. Before they could see name changes
  for deleted users on user profiles, but not on the user name changes index.

* Let members see previous names on profile pages. Before they could see
  previous names on the user name changes index, but not on profile pages
  (ref: #4382).
2020-04-03 23:44:02 -05:00
evazion
ce11485fe0 Remove super voters. 2020-02-23 17:52:38 -06:00
evazion
2f5255f6b7 user presenter: fix syntax error in previous names.
Fixup for 0ad42d23c.
2020-02-21 00:20:18 -06:00
evazion
0ad42d23c9 models: refactor search visibility methods.
Refactor how model visibility works in index actions:

* Call `visible` in the controller instead of in model `search`
  methods. This decouples model visibility from model searching.

* Explicitly pass CurrentUser when calling `visible`. This reduces
  hidden dependencies on the current user inside models.

* Standardize on calling the method `visible`. In some places it was
  called `permitted` instead.

* Add a `visible` base method to ApplicationModel.
2020-02-19 17:08:59 -06:00
evazion
60ff2ae929 models: rename post/pool archives to post/pool versions. 2020-02-15 06:52:10 -06:00
evazion
3c2a379d6f uploads: replace old upload limits with new upload limits. 2020-02-03 22:05:58 -06:00
evazion
edaf6323fd /favorite_groups: add search, creators, timestamps, edit/delete links. 2020-01-22 02:03:19 -06:00
evazion
4a7322b197 users: rework privacy mode into private favorites (fix #4257).
* Rename 'privacy mode' to 'private favorites'.
* Make the private favorites setting only hide favorites, not favgroups
  and not the user's uploads on their profile page.
* Make the favgroup is_public flag default to true instead of false and
  fix existing favgroups to be public if the user didn't have privacy mode
  enabled before.
* List _all_ public favgroups on the /favorite_groups index, not just
  favgroups belonging to the current user.
* Add a /users/<id>/favorite_groups endpoint.
2020-01-17 22:24:29 -06:00
evazion
617e1ca98a users/show: change favcount link to ordfav: search. 2020-01-15 13:22:30 -06:00
evazion
77935808e2 user profiles: fix links when Post.fast_count returns nil.
If Post.fast_count returns nil, then the link_to call becomes
link_to(nil, <posts_path>) so the link text becomes the url itself,
which isn't what we want.

Instead the count is displayed as a '?' mark to indicate that we don't
know the true count.
2020-01-05 17:48:50 -06:00
evazion
309821bf73 rubocop: fix various style issues. 2019-12-22 21:23:37 -06:00
evazion
a39b67b901 Remove mod-only user revert system (#4178).
The mass undo system from #4178 replaces this system.

Followup to f2dccf8cf.
2019-09-27 21:48:49 -05:00
evazion
9a3e9747d8 users: replace scopes with associations. 2019-08-29 20:42:50 -05:00
evazion
a64cd50be4 profiles: add account upgrade link. 2019-08-15 12:51:51 -05:00
evazion
692981e964 Fix #4111: Cache custom CSS. 2019-08-01 00:06:18 -05:00
evazion
0966a290e4 Fix #3941: Add ability to search users by inviter. 2018-10-04 12:44:59 -05:00
evazion
03abbd0683 Fix #2894: Use [[:space:]] instead of \s in regexes. 2018-09-20 19:24:38 -05:00
evazion
b711566c14 Fix #3438: Thumbnails on user profiles don't respect safe mode. 2017-12-19 13:58:41 -06:00
evazion
1ef363dd68 upload limits: add time remaining until next upload to profiles (fix #3262). 2017-08-10 23:58:58 -05:00
evazion
bf3101da48 upload limits: show how upload limits are calculated in profiles.
* Allow mousing over the upload limit on profile pages to show the full
  formula for the upload limit calculation. In particular, show how the
  upload limit multiplier is derived from the deletion confidence.

* Refactor to avoid duplicating upload limit calculations in the
  presenter, as much as possible.
2017-08-10 23:48:50 -05:00
r888888888
97da8f8647 deprecate tag subscriptions with warnings 2017-04-14 16:00:20 -07:00
r888888888
91c21b1bac fixes #2880: Change link from User page "Comments in xxxx posts" to comment_bumped 2017-03-21 14:05:32 -07:00
r888888888
da06bee0ab revamp saved search implementation 2017-03-15 15:36:48 -07:00
r888888888
aa41c41572 fixes #2876: Changing approver/contributor privileges should log mod action 2017-02-14 12:46:54 -08:00
r888888888
ed8a8001f4 fixes #2859: search:uncategorized should search for uncategorized saved searches 2017-02-14 11:58:43 -08:00
evazion
1f325c19da Show previous usernames to members; link to actual change requests. 2017-01-11 13:07:39 -06:00
Albert Yi
62956be384 hide saved search functionality if not enabled 2016-12-21 14:53:39 -08:00
Albert Yi
ee4ebce4d7 support pool version archive 2016-12-21 11:43:46 -08:00
r888888888
5b48d272f2 add basic user revert functionality 2016-09-28 11:38:34 -07:00
r888888888
de9116947f fixes #2641 2016-08-26 15:52:37 -07:00
r888888888
6d20ecb20d fix typo in user presenter 2016-08-22 16:29:51 -07:00
r888888888
d0bbe27217 include saved searches section in user profiles 2016-08-22 14:59:43 -07:00
r888888888
5de9adf0f5 work on saved searches embedded in user profiles 2016-08-19 17:33:42 -07:00
r888888888
09ca8df6b3 change user deletion scope from 120 days to 60 days 2015-10-19 14:33:05 -07:00
r888888888
5a853bcedb tweaks to new can_upload_free flag #2469 2015-10-15 16:23:30 -07:00
r888888888
6480864718 fixes #2469 2015-10-15 15:24:24 -07:00
Toks
a1642f1c74 Flag/appeal search: fix creator param not always being preserved 2015-09-24 10:11:05 -04:00
r888888888
e7c48dc939 fixes #2519: User profiles broken 2015-09-17 13:16:44 -07:00
r888888888
6297ff8638 reduce factor of comic uploads 2015-09-16 14:02:02 -07:00