Commit Graph

92 Commits

Author SHA1 Message Date
evazion
be36968b6d Fix #3351: Mod+: Treat deleted comments as below score threshold.
Comments have three states: visible, hidden, and invisible. Visible
comments are always shown. Hidden comments are not shown until the user
clicks 'Show all comments'. Invisible comments are never shown to the
user. Deleted comments are treated as hidden for moderators and
invisible for normal users. Thresholded comments are treated as hidden
for all users.
2019-08-31 16:24:44 -05:00
evazion
a3d748e300 Fix #4145: Unable to view deleted comments from post page.
Bug: if all the comments on a post were deleted then the deleted
comments wouldn't be visible to moderators.

This was because we assumed that if `last_commented_at` was nil it meant
that the post had no comments, but this was wrong. `last_commented_at`
only counts undeleted comments. It's reset to nil if all the commnets
have been deleted.
2019-08-26 13:50:42 -05:00
evazion
b283281e5e comments: minimize sql queries.
Certain parts of comment rendering triggered sql queries that we didn't
really need to do. Rework things to avoid this.

* Preload comment creators in order to display commenter names with link_to_user.

* Preload comment votes in order to display "undo vote" links. Only preload
  votes for members since anonymous users can't vote and don't have "undo
  vote" links.

* Rework various conditionals to do the filtering in Ruby so that we
  avoid issuing any extra queries in sql.

* Avoid issuing any queries at all when the post doesn't have any
  comments (when last_commented_at is blank).
2019-08-20 21:55:25 -05:00
evazion
2cf929ad6e comments: show "undo vote" link by default on voted comments (fix #4143). 2019-08-20 21:17:02 -05:00
evazion
59b277ead1 users: drop id_to_name, name_to_id caching.
Changes:

* Drop Users.id_to_name.
* Don't cache Users.name_to_id.
* Replace calls to name_to_id with find_by_name when possible.
* Don't autodefine creator_name in belongs_to_creator.
* Don't autodefine updater_name in belongs_to_updater.
* Instead manually define creator_name / updater_name only on models that need
  to return these fields in the api.

id_to_name was cached to reduce the impact of N+1 query patterns in
certain places, especially in api responses that return creator_name /
updater_name fields. But it still meant we were doing N calls to
memcache. Using `includes` to prefetch users avoids this N+1 pattern.

name_to_id had no need be cached, it was never used in any performance-
sensitive contexts.

Avoiding caching also avoids the need to keep these caches consistent.
2019-08-18 11:24:42 -05:00
evazion
98d80a0cca Fix #4116: "Couldn't find template for digesting" errors.
Specify full path to shared partial to work around bug in the template
digesting system in Rails.
2019-08-03 17:40:45 -05:00
evazion
80f43f9a7c Fix #4038: Attempting to create an IP-ban bans the creator.
* Rename comments.ip_addr to comments.creator_ip_addr.
* Fix belongs_to_creator to not clobber ip_addr field.
2019-01-09 16:20:34 -06:00
evazion
d213173d3d Fix #4002: Always include "updated by" line when creator != updater 2018-12-08 11:30:11 -06: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
evazion
dfb7cf6994 comments: add standalone new comment form.
Add standalone /comments/new page to allow commenting if javascript is
disabled.
2018-09-29 20:42:38 -05:00
evazion
9ac59aeadd comments.js: clean up comment quoting.
Replace Comment.quote with a remote new.js.erb call.
2018-09-29 20:42:38 -05:00
evazion
130570aa33 comments.js: fix thresholded comments.
* Restore behavior of thresholded comments being greyed out (lost in 6fa0ae2cf).

* Set the `below-threshold` class for thresholded comments in the html instead of in javascript.

* Remove `include_below_threshold` param; it was always true when clicking "Show all comments".
2018-08-09 14:45:26 -05:00
evazion
8e8a39af43 comments.js: fix forms flickering on page load.
Mark the edit form, new comment form, and unvote links as hidden in
html, instead of showing them by default then hiding them later in
Javascript. This eliminates flickering on page load.
2018-08-09 14:44:20 -05:00
Albert Yi
7b74f5caf6 switch to using thumbs for voting 2018-07-06 11:02:14 -07:00
Albert Yi
6c790c61d3 replace uploader information post previews and comment listing, rename tagger to top tagger 2018-03-27 10:49:41 -07:00
r888888888
3ffd871e8a fixes #3291 2017-09-14 11:23:51 -07:00
evazion
7cb7c2fbab Remove ruby DText implementation (#3206). 2017-07-19 16:48:42 -05:00
evazion
85d1f18ba5 comments: make commenter ip addresses visible to mods. 2017-03-19 23:41:25 -05:00
evazion
b80976bce7 modqueue: link tags, like they are in /comments. 2017-02-24 21:03:14 -06:00
Albert Yi
bdac591266 fixes #2838 2017-01-16 12:57:43 -08:00
evazion
4e8006ae3b Optimize rendering of post commenter names.
Eager load post comments' creators and updaters. Fixes an N+1 queries
problem when rendering commenter names at:

    views/comments/partials/show/_comment.html.erb:6
    views/comments/partials/show/_comment.html.erb:20

while rendering /posts/:id pages.
2017-01-03 20:14:05 +00:00
evazion
1257639109 Add 'post as moderator' option for comments.
* Add 'post as moderator' option to comment form. This creates a so-called sticky comment.
* Downvotes have no effect on stickied comments; they're always visible, regardless of comment thresholds.
* Only mods may sticky comments.
* Mods may sticky comments by other users.
2016-12-26 23:52:45 -06:00
evazion
7c838f8525 Delete unused /comments/index_all route and unused _threshold.html.erb template. 2016-12-26 23:52:27 -06:00
Albert Yi
aef31d8d9b enable ragel parser for comments, add additional sql diagnostic queries 2016-12-09 14:59:33 -08:00
r888888888
6d6d00b190 expose voting to non-gold supervoters 2016-03-14 16:52:49 -07:00
r888888888
8a63fb0f7c enable mention for comments #2466 2015-11-30 16:51:07 -08:00
Toks
a4440514ff Allow undeleting comments 2015-07-11 13:26:55 -04:00
Toks
4f4fd8cb35 fixes #2428 2015-07-04 22:00:31 -04:00
evazion
b56d7bdfa8 Disable comment submit button to prevent double posting. 2014-10-07 13:52:28 -05:00
r888888888
fad0ab7c93 fixes #2133 2014-04-16 17:43:34 -07:00
Toks
11984fe8ed #1902: Add forum/comment creator data 2013-08-07 20:15:35 -04:00
Toks
938e19f384 merge branch changeable-votes 2013-06-29 15:12:38 -04:00
Toks
badc3122f0 fixes #1263 for comments 2013-06-29 14:50:22 -04:00
Toks
7719cc2104 don't show comment updated by if the edit occurred within 5 minutes 2013-06-24 11:17:43 -04:00
Toks
4765ce11b6 name consistency (#1424) 2013-06-14 12:32:25 -04:00
Toks
739da4c4b9 fixes #1424 for comments 2013-06-14 12:23:10 -04:00
Toks
8f17a505e6 fixes #1422 2013-05-11 22:22:59 -04:00
Toks
1d56f237a8 error msg consistency 2013-05-06 10:06:25 -04:00
r888888888
d5f575159f rename references of privileged to gold 2013-04-28 00:04:52 -07:00
Toks
4f16cdf145 fixes #1295 2013-04-13 15:19:04 -04:00
Toks
8b33cac661 replace old user links with new format 2013-04-04 23:16:28 -04:00
Toks
6746d67e31 adds user level classes to comment index by post 2013-04-04 19:10:02 -04:00
Toks
4f42ab8bdb adds support for user level-dependent classes
all links to users should have their class attribute set to that user's
level_class
2013-03-30 12:04:58 -04:00
albert
ec50911a52 Merge branch 'master' of github.com:r888888888/danbooru 2013-03-22 18:14:42 -04:00
albert
8bfd7b408f remove links that are not usable by anon users, fixes #977 2013-03-22 10:18:05 -07:00
Moebius-Strip
f483f59786 Typo causing a misplaced percent sign in the HTML
I know nothing about eRuby, but there's definitely a random percent sign showing up in the HTML and this looks like the culprit to me.
2013-03-22 02:16:51 -03:00
albert
9cdc2a7cd7 fixes #1014 2013-03-21 17:58:55 -07:00
小太
1a03a86592 Kill trailing whitespace in erb files 2013-03-19 23:11:58 +11:00
albert
04b18abc6e style updates 2013-03-17 23:48:06 -04:00
albert
28a40aeee4 fixes #925 2013-03-17 20:33:25 -04:00