Commit Graph

49 Commits

Author SHA1 Message Date
evazion
bf022e858a seo: prevent crawlers from crawling /posts/:id/favorites. 2021-12-10 01:46:01 -06:00
evazion
3ae62d08eb favorites: show favlist when hovering over favcount.
Changes:

* Make it so you can click or hover over a post's favorite count to see
  the list of public favorites.
* Remove the "Show »" button next to the favorite count.
* Make the favorites list visible to all users. Before favorites were
  only visible to Gold users.
* Make the /favorites page show the list of all public favorites,
  instead of redirecting to the current user's favorites.
* Add /posts/:id/favorites endpoint.
* Add /users/:id/favorites endpoint.

This is for several reasons:

* To make viewing favorites work the same way as viewing upvotes.
* To make posts load faster for Gold users. Before, we loaded all the
  favorites when viewing a post, even when the user didn't look at them.
  This made pageloads slower for posts that had hundreds or thousands of
  favorites. Now we only load the favlist if the user hovers over the favcount.
* To make the favorite list visible to all users. Before, it wasn't
  visible to non-Gold users, because of the performance issue listed above.
* To make it more obvious that favorites are public by default. Before,
  since regular users could only see the favcount, they may have
  mistakenly believed other users couldn't see their favorites.
2021-11-20 02:40:18 -06:00
evazion
1653392361 posts: stop updating fav_string attribute.
Stop updating the fav_string attribute on posts. The column still exists
on the table, but is no longer used or updated.

Like the pool_string in 7d503f08, the fav_string was used in the past to
facilitate `fav:X` searches. Posts had a hidden fav_string column that
contained a list of every user who favorited the post. These were
treated like fake hidden tags on the post so that a search for `fav:X`
was treated like a tag search.

The fav_string attribute has been unused for search purposes for a while
now. It was only kept because of technicalities that required
departitioning the favorites table first (340e1008e) before it could be
removed. Basically, removing favorites with `@favorite.destroy` was
slow because Rails always deletes object by ID, but we didn't have an
index on favorites.id, and we couldn't easily add one until the
favorites table was departitioned.

Fixes #4652. See https://github.com/danbooru/danbooru/issues/4652#issuecomment-754993802
for more discussion of issues caused by the fav_string (in short: write
amplification, post table bloat, and favorite inconsistency problems).
2021-10-09 22:36:26 -05:00
evazion
ffdd5e6128 posts: make post votes work the same way as comment votes.
Change post votes to work the same way as comment votes:

* Make the upvote arrow blue if you've upvoted the post, or grey if you
  haven't. Likewise for the downvote arrow.
* Make it so you can click the upvote or downvote arrows to undo the vote.
* Don't show any notices when you vote on a post.

Also fix it so that votes work the same way on the posts page, the
comments page, and in the modqueue. Before it wasn't possible to undo
votes on the comments page or in the modqueue.
2021-01-29 02:21:08 -06:00
evazion
11a8c2877b favorites: refactor favlist order on post page.
On the posts show page, in the favorites list, show favorites according
to the order they were added to the favorites table, rather than the
order they were added to the posts's fav_string.

On most posts these should be the same, but on old posts they may be
slightly different. The IDs of the first few hundred thousand favorites
don't appear to be in chronological order. Probably the original
favorite IDs were lost and recreated by a database move at some point in
Danbooru's history. The fav_string is also inconsistent with the
favorites table in some places (one contains favorites that aren't
contained by the other), which also throws off the order.

Partially addresses #4562 by eliminating one place where we depended on
the fav_string.
2021-01-03 19:15:17 -06:00
lllusion3469
eb564a4ef2 Show or hide post vote buttons when (un)favoriting
When favoriting/unfavoriting a post, it would also be upvoted/"un"voted
but the upvote/downvote/undo vote buttons would stay shown/hidden as
they were before unlike when pressing those buttons.

For example when you want change from favorite to merely upvoted you
would have to reload the page in between.
2020-04-07 02:15:21 +02:00
evazion
a5418abb31 pundit: convert posts to pundit. 2020-03-20 18:03:01 -05:00
evazion
b77eebf136 /favorites: replace favorites view with ordfav: search.
Make /favorites redirect to a ordfav:<user> search instead of having a
separate view just for favorites. This duplicated a lot of code for no
good reason.
2019-08-31 19:58:38 -05:00
evazion
e000bdb861 js: drop jquery-timeout plugin.
Replace with `Danbooru.Utility.delay`.
2019-08-14 01:46:44 -05:00
Albert Yi
035a0026cd fixes #4050 2019-01-22 15:14:10 -08:00
Albert Yi
21a08d17a4 tweak styles for fav button 2018-10-24 10:02:50 -07:00
evazion
99632d5e8a TagSetPresenter: refactor to pass options explicitly.
Refactor tag_list_html, split_tag_list_html, and inline_tag_list_html to
take the `show_extra_links` and `current_query` options explicitly,
rather than implicitly relying on CurrentUser or taking `params[:tags]`
from the template.
2018-09-30 21:52:24 -05:00
Albert Yi
77d0c46b35 Merge pull request #3812 from evazion/feat-declarative-shortcuts
Add declarative keyboard shortcuts
2018-08-13 18:08:31 -07:00
evazion
bcaee199f5 favorites: unify create.js.erb & destory.js.erb code paths. 2018-08-12 15:51:18 -05:00
evazion
fb91bbc6c5 Fix #3813: Favorite limit can be bypassed. 2018-08-12 14:22:08 -05:00
evazion
bbaadda1e3 Convert keyboard shortcuts to use data-shortcut. 2018-08-12 12:09:58 -05:00
Albert Yi
718e641f51 remove similar users report 2018-08-03 17:40:00 -07:00
Albert Yi
6fa0ae2cf1 Migrate assets to use Webpacker 2018-07-27 15:24:05 -07:00
BrokenEagle
5cdd8d8f67 Standardize position of page title and secondary links
- Removed path specification for secondary links where unneeded
2017-12-28 10:20:27 -08:00
r888888888
bb228d5735 add favorite action underneath image 2017-09-05 14:41:33 -07:00
r888888888
e04a62b962 more crawler constraints 2016-02-05 14:17:26 -08:00
r888888888
873a978c2d link similar users 2016-01-07 17:28:14 -08:00
r888888888
bfceb8b388 fix missing tags_dom_id in partials 2015-07-16 18:07:17 -07:00
Toks
e6c4cd6c6d fixes #2014 2014-10-31 14:05:33 -04:00
Toks
07f3c1e655 fixes #1965 2013-09-06 10:32:54 -04:00
Toks
03aee0f664 Fix document title when viewing other users' favorites 2013-07-14 19:44:35 -04:00
Toks
ddfa019c4c fixes #1596 2013-05-11 18:00:28 -04:00
Toks
6ab405c142 fixes #1403 2013-05-03 19:54:01 -04:00
r888888888
d5f575159f rename references of privileged to gold 2013-04-28 00:04:52 -07:00
Toks
3ae84a9662 fixes #1343 2013-04-15 18:40:53 -04:00
Toks
c9400e404d fixes #449 2013-04-14 12:56:35 -04:00
albert
6933cfba26 fixes #972 2013-03-22 10:25:01 -07:00
小太
1a03a86592 Kill trailing whitespace in erb files 2013-03-19 23:11:58 +11:00
albert
9221e9ae9f fixes #952 2013-03-18 15:20:07 -07:00
albert
caacd3f86f fixes #733 2013-03-03 15:37:20 -05:00
albert
6a1db1197b fixes #670 2013-03-01 07:33:19 -08:00
albert
66fc05e30b change privileged accounts to gold accounts, add platinum accounts, add favorite and tag query limiting based on level 2013-02-20 00:02:43 -05:00
albert
8a66470975 enable blacklists in comments, wiki pages 2013-02-18 19:11:30 -05:00
albert
f6367aab49 layout fixes 2011-11-03 17:14:41 -04:00
albert
34ae712be0 fixed titles 2011-10-23 16:55:57 -04:00
albert
24bf21540a refactoring views 2011-08-16 18:47:01 -04:00
albert
c8afd34d15 added ip addr search 2011-07-29 18:04:50 -04:00
albert
739e28919a refactoring 2011-06-25 19:31:39 -04:00
albert
2f1fdcb459 more work on paginators 2011-06-21 14:32:07 -04:00
albert
42627be1d3 moved out search pages 2011-03-15 19:19:49 -04:00
albert
9c0a961ab2 major refactoring of javascripts 2011-03-10 17:59:42 -05:00
albert
6d0157265c pool views 2011-02-25 17:41:00 -05:00
albert
39dd2e277a * Refactored PostSet, splitting it into PostSets::Post and PostSets::Favorite
* Additional functional tests
2010-12-01 17:21:05 -05:00
albert
c6304c6e08 views 2010-11-19 16:24:17 -05:00