Commit Graph

624 Commits

Author SHA1 Message Date
evazion
62875eabb2 /posts.atom: fix banned posts being visible to Members.
Bug: /posts.atom only hid loli/shota, not banned posts and not unsafe
posts when safe mode was on.
2019-08-25 20:29:32 -05:00
evazion
bb82011bb2 helpers: drop fast_link_to. 2019-08-22 23:33:58 -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
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
d0d71fcdc8 posts/index: disable next page prefetching.
This causes the browser to prefetch the next page in a search, which may
make browsing seem faster to the end user, but it effectively doubles
the load on the server.
2019-08-12 18:17:04 -05:00
evazion
14da425564 search: reduce queries in single tag searches (#4120).
Avoid some queries used in wiki page excerpts:

* Only try to load the artist if the tag is an artist tag.
* Avoid using `exists?` queries for wiki pages.
* Bugfix: don't show wiki excerpts for deleted wikis.
2019-08-12 13:38:45 -05:00
evazion
f77d305f83 Fix #3250: Show unvote link as applicable upon page load. 2019-08-04 18:58:25 -05:00
Albert Yi
d8aabff77b remove post keeper references 2019-01-31 15:45:06 -08:00
Albert Yi
33063a72de Add a listing page for post disapprovals (accessible to approvers only) 2019-01-24 16:14:57 -08:00
Albert Yi
a5943d2c3a Merge pull request #4044 from r888888888/tag-change-notices
Tag change notices
2019-01-24 14:23:35 -08:00
Albert Yi
4fe7f5eff9 restyling 2019-01-23 17:40:58 -08:00
Albert Yi
1550538dc1 Tag change notices
This adds a small notice at the bottom of post searches if a single tag search is the target of any tag change request.
2019-01-22 17:22:07 -08:00
Albert Yi
746ad2822c fixes #4049: Trying to open safeblocked posts in safe mode results in 500 server error 2019-01-22 16:46:57 -08:00
Albert Yi
035a0026cd fixes #4050 2019-01-22 15:14:10 -08:00
evazion
b24ccb0595 tag edit dialog: fix clicking button before handler is bound.
https://danbooru.donmai.us/forum_topics/9127?page=265#forum_post_153180:

> I'm not sure how to reproduce this, but sometimes on the upload page
> when I click the button to pop out the tag box, the screen scrolls up to
> the picture but the box doesn't pop out, and I have to scroll back down
> and click it again

https://danbooru.donmai.us/forum_topics/9127?page=266#forum_post_153183:

> Yes, this was brought up by Unbreakable on Discord a while back. It's
> due to the fact that the event handler that pops out the dialog box has
> not yet been bound by the time you click it. Since that clickable
> control has an empty anchor link of "#" which goes nowhere, it therefore
> redirects the user to the top of the page.
2018-12-18 19:10:23 -06:00
Albert Yi
8ac530a909 fixes #4006: Bring back the "edit tags" button to the sidebar
fixes #4011: Comment input field under posts is too big, goes slightly beyond view boundaries
fixes #4010: Incorrect dynamic tag counts
2018-12-12 11:44:25 -08:00
evazion
79ec053cef Fix #4009: Tag list is empty when editing tags, causing destructive changes. 2018-12-12 13:02:04 -06:00
Albert Yi
4706cae114 Add user permissions for flagging and for giving user feedback 2018-12-11 17:08:31 -08:00
Albert Yi
3893926048 add dynamic tag counts on upload form 2018-12-10 17:51:28 -08:00
evazion
fe60672ef3 Fix #4005: Add confirmation for unbanning a post. 2018-12-10 00:39:02 -06:00
evazion
4fcb82f2e6 Fix #3991: Loading post #1604318 is broken.
Fix exception in Pool#previous_post_id when the post id is not contained
in the pool.

This can happen when a post's pool_string lists the post as being in a
certain pool, but the post is not included in the pool's post_ids. Such
pool_string / post_ids inconsistencies exist because of past bugs.
2018-11-15 10:28:20 -06:00
Albert Yi
5493e16f04 tweak matomo tracking 2018-11-12 10:28:48 -08:00
Albert Yi
684e2bdbad fix undefined _paq references 2018-11-09 15:49:42 -08:00
Albert Yi
c8793457cb remove mixpanel + add more matomo tracking 2018-11-09 15:40:38 -08:00
evazion
115ed16a96 pools: store post_ids as array instead of string (fix #3979) 2018-11-08 15:09:31 -06:00
evazion
bd0bb658b8 Fix #3974: Pool galleries: link thumbnails to pools instead of posts. 2018-11-06 14:33:04 -06:00
evazion
ff9ce25b01 Fix #3973: Pool gallery is broken. 2018-11-06 13:11:11 -06:00
Albert Yi
1d3eb584c7 fix new postpresenter styles 2018-11-05 15:11:27 -08:00
evazion
29b6121a07 pools: refactor #neighbors + fix broken #neighbors tests. 2018-11-04 19:40:57 -06:00
evazion
19b92acabc Fix #3970: Make "Copy all notes" not builder exclusive. 2018-11-04 16:42:55 -06:00
Albert Yi
e360058aca refactor 2018-11-02 13:40:01 -07:00
Albert Yi
542641e3e2 refactor pool nav html 2018-11-01 17:42:49 -07:00
Albert Yi
e334c34836 fix image container html 2018-10-31 16:15:07 -07:00
evazion
39374a70d3 posts/show: rename tags params to q in various places.
Fixup for 011a6f1f7.
2018-10-30 11:32:07 -05:00
Albert Yi
011a6f1f7c move post preview presenter to partial 2018-10-29 17:46:45 -07:00
Albert Yi
a2811d1484 add shareout options 2018-10-25 16:46:25 -07:00
Albert Yi
4d07183a1d Merge pull request #3957 from evazion/fix-related-tags
Related tags: build html server-side, eliminate cookies
2018-10-24 17:34:14 -07:00
Albert Yi
21a08d17a4 tweak styles for fav button 2018-10-24 10:02:50 -07:00
Albert Yi
c0ab54b889 css tweaks 2018-10-23 18:30:35 -07:00
Albert Yi
38d94a7d37 update meta tags 2018-10-23 11:24:43 -07:00
Albert Yi
261cc8d993 remove index/show mixpanel events 2018-10-23 11:02:30 -07:00
Albert Yi
9ce419b692 fix user editing 2018-10-22 17:35:59 -07:00
Albert Yi
464596fbb4 disable some props 2018-10-22 17:28:04 -07:00
Albert Yi
f4cafebd0f fix escaping 2018-10-22 17:25:14 -07:00
Albert Yi
11e75aec2a add referer prop 2018-10-22 17:21:26 -07:00
Albert Yi
1b9e3d687d add events for posts pages 2018-10-22 17:19:32 -07:00
Albert Yi
08e3051d31 add mixpanel events for signup page 2018-10-22 17:05:05 -07:00
Albert Yi
c1f70b9a02 truncate og description to 350 chars 2018-10-22 14:01:25 -07:00
Albert Yi
683b45c031 update dtext gem 2018-10-22 13:48:50 -07:00
Albert Yi
5d3f072a2f fix wiki excerpt links 2018-10-22 13:15:33 -07:00