Pending a more thorough comments rework, make comment listings denser:
- Reduce margin between comments from 28px to 3.5px.
- Reduce padding around comment text from 10px to 5px.
- Shrink comment-actions text size by 20% to maintain visual balance.
- Add some padding to frontpage list entries, because the size of
voting arrows was holding the size up. Should be about the same
as before action icons were shrinked.
Also wound up semi-unrelated fixing the comment nesting border-left
colors on TheMotte mobile, coffee, win98, dramblr, and midnight.
All changes tested most thoroughly on those themes.
Bug accidentally introduced with 70c8a942b6, when a removed clause
in Comment.collapse_for_user was treated as always True, rather than
as always False--which would've removed this entire line, as this
commit does now.
Original intent of the logic was for auto-collapsing game comments
like blackjack and slots that necessarily entailed somewhat spammy
commenting behavior.
Originally motivated by fixing #263 (add a mod list), the root cause
of which was that we had a number of orphaned pages, one being the
admins list.
In the upstream, we moved links to a number of infrequently-accessed
pages to a secondary nav in the sidebar. This commit implements a
similar approach to provide links to the admin list and modlog. To
make the nav less visually unbalanced, Random Post/User were also
moved out of the header.
To provide mobile support, this secondary nav is presented in the
hamburger menu. This also provides a place to link /rules, which
otherwise has no link on mobile (that I can readily find).
Finally, the original intent of providing a mod list motivates some
style changes to admins.html to get rid of visible truescore, make
names appear consistently with names elsewhere, and ensure links to
leaderboard aren't accidentally leaked.
Resolves root problem of non-admin users seeing comments they shouldn't
by JOINing on the appropriate fields and including them in the WHERE
clause of the query.
In the process, was also able to remove some unperformant queries
that used (potentially extremely long) lists passed to WHERE clauses in
lieu of proper JOINs.
The Slur Replacer feature from rDrama has already been removed, but
the toggle for it in settings remained. A user in Discord pointed out
it was confusing and potentially disconcerting to have a default-on
toggle to 'enable slurs'.
Explicitly exempts admin action routes from rate limiting because
the limits were being hit during normal user behavior.
While verbose, alternatives like grouping admin routes into e.g. a
Flask blueprint to modify their behavior as a collective would have
been a larger refactor than seemed wise at the moment.
Also, some routes that were limited at 1/second were originally set
as such as a makeshift debounce for people double-clicking buttons.
This was discussed and deemed an acceptable risk compared to making
the mod queue more frustrating to go through.
Logic already existed for this and is operative on the upstream.
However, it was restricted to only show sidebars for posts inside
subs ("holes"). We simply remove that check so it works on posts
without a sub set, namely all of the ones on TheMotte.
The last places coins were visible to non-admins were in user popovers
and, potentially, via direct access of /@<username>/coins. These have
been removed.
Additionally, there are a number of routes which, despite being removed
from the UI, were still operative and usable. These are disabled
pending possible(?) future uses of coins.
Due to use of Submission.{choices, options, bet_options} in realbody,
generating submission_listings resulted in extremely high volume of
SELECT queries.
In local testing with 6 posts, one of which had a poll with 2 options,
the removal of these calls reduced quantity of queries on the homepage
from 84 to 22.
Given that it was previously decided to remove the polls feature after
a regression while adding comment filtering, the remaining dead code
paths for polls were also removed.
Logic to provide new comment count indicators on submission_listings
exists but seems to have been lost on desktop (though working on
mobile) during some frontpage design changes. We now add it back.
Ports in lightly modified logic from the upstream which tracks active
sessions to provide counters and listings to understand site traffic
in the admin panel.
Given that coins are not visible in many contexts, the conspicuous
appearance of treasure chests (random coin rewards on 1% of comments)
seems out of place. This removes the logic which rewards treasure,
the visible display of treasure, and drops the column containing
treasure information which has already been awarded to at least one
comment on prod.
Style changes in three contexts, especially for contrast/visibility:
- Highlighting for new comments is now _much_ lighter.
- Blockquotes display similarly to reddit-style: slightly muted
text with a grey bar to the left but no background otherwise.
- Prev/Next pagination for listings now readable and distinct.
Only applied to TheMotte.css, since it seems the one with complaints.
Using the new assetcache module, we replace (almost) all instances
of `?v=` cachebusting query parameters in Python and in Jinja templates.
The primary exceptions were: user site backgrounds, and some
infrequently changed graphics referenced literally from .js files.
Rather than generating the URL in helpers/jinja2.py, we move the logic
to helpers/assetcache.py because there are consumers of asset URLs
in Python code (for better or for worse).
Provides a module `assetcache` to support automatic cachebusting of
static web assets, rather than the current approach of incrementing
a version number.
On module load, it walks the file/assets/ dir, computes a CRC32 of
each asset, and provides those hashes via `assetcache_get(path)` at
runtime. The primary consumer of hashes at present is the new `asset`
filter for Jinja2, which accepts a relative asset path and returns the
full path, with cache busting, suitable for final use in the template.
Ex: `{{ 'css/main.css' | asset }}`
Fixes#221. Provides custom message behavior for the user DM route
and slightly refactors the `@is_not_permabanned` wrapper to not be
deliberately misleading to users.
Recently, unrelated changes led to enabling logging for flask-limiter
accidentally, at which point it was discovered that it wasn't actually
limiting requests due to Limiter.key_func = get_CF not being proper
for either prod (not behind Cloudflare) or localhost (likewise).
We instead use the remote_addr attached directly to the request using
the existing flask-limiter function to do so.
Detailed troubleshooting at:
https://github.com/themotte/rDrama/issues/222#issuecomment-1229489062
Another JS load order bug, previously fixed upstream. bs_trigger() in
header.js must be run after DOM content is loaded to properly set the
events for tooltips to appear on hover. This commit uses standard
document ready event boilerplate to ensure this happens, regardless
of script load order.