Commit graph

1207 commits

Author SHA1 Message Date
justcool393
94e40ff725
unstomp on is_notification_page (#579)
* unstomp on `is_notification_page`

* remove duplicated reply button
2023-04-13 22:35:59 -05:00
justcool393
541af718bb readd mistakenly deleted reply button 2023-04-09 07:16:13 -06:00
TLSM
b04849e5b7 hotfix: comment nesting in template from #535
In some cases, #535 caused comment display to wildly break visible
page formatting. The sidebar often moved to bottom of page, and some
comments would display in a second column alongside the main one.

Root cause was a closing `</div>` left outside of a conditional
which was included in rendered markup even when:
 1) A comment is invisible for the current browsing user v, e.g.
    filtered or removed.
 2) The subtree rooted at said comment is to be hidden based on
    the display logic added in #535.
Which left a stray `</div>` with no opening tag where those
comments should've gone.

Most of the testing appears to have been done on reply chains of
comments, which behave correctly. It is specifically the zero
children (or otherwise not even showing a "Removed" message in the
page) which causes the bug.
2023-04-03 20:22:41 -06:00
justcool393
39ce6a4ee9
invisibleify completely removed trees only (fixes #431) (#535)
* invisibleify completely removed trees only (fixes #431)

* fix visibility state for shadowbanned users.
this also ends up moving some of the complexity out of the templates.

* comments: remove unused variable

* moderation state machine

* no seriously this really should check for v not being None

* fix shadowban state

* fix visibility state

* update stateful counters

* don't use bespoke function for show_descendants

* properly mock ModerationState for cron submissions

* fix approval discrepency

* remove treenukes for removed comments

* show shadowbans as removed
2023-04-03 04:30:46 -05:00
justcool393
77af24a5b1
remove holes (#492)
* remove holes

* don't import class that doesn't exist

* remove subs in template code

* remove subs_created

* fix sticky bug

* uh... i think this will fix it????

* fix stupid nearly ungrokkable nesting error

* ...

* ....

* ....

* *sigh*

* .............................i think i got it.

* Revert ".............................i think i got it."

This reverts commit 419a545875.

* Revert "*sigh*"

This reverts commit fcfc9d7995.

* Revert "...."

This reverts commit e200c8f6f0.

* Revert "...."

This reverts commit 681db8cb02.

* Revert "..."

This reverts commit c54372b9ff.

* Revert "fix stupid nearly ungrokkable nesting error"

This reverts commit e202fd774c.

* Revert "uh... i think this will fix it????"

This reverts commit e4d9366093.

* readd missing endif

* fix email templates.

* fix frontpage listing

* some minor fixes wrt saving

* fix some listing errors

* Remove more references to holes system

A couple of these came from the merge of #554. A few others were just
left in the templates and presumably hard to catch on the first
removal pass.

* remove unnecessary lazy

* Add migration

Tested. Very sensitive to order. I wound up borrowing the statement
order we used for deleting sub rows on upstream (manually, of course).

---------

Co-authored-by: TLSM <duolsm@outlook.com>
2023-04-01 00:13:30 -05:00
TLSM
a9090b01e2 fix: duplicated notification header text
Seems to be a simple accidental duplication of the message left in
during the rewrite.
2023-03-16 11:12:24 -05:00
Ben Rog-Wilhelm
1bd1eadefe Fix: Typo in comment refactor. 2023-03-14 13:50:42 -05:00
justcool393
8acddebb93 actually set is_notification_page
apparently this has just been a bug for over a year on rdrama
2023-03-14 13:10:26 -05:00
justcool393
c670518a5e components: move around a bit 2023-03-12 07:38:27 -05:00
justcool393
8240ddcc43 organize modals 2023-03-11 03:16:55 -06:00
justcool393
b32d32a658 Don't duplicate view more button code 2023-03-11 03:04:29 -06:00
justcool393
fde6d8a67a fix bug and move render context partly to model 2023-03-09 07:22:01 -06:00
justcool393
9895fa1bba comments.html: refactor so that something can be sanely
changed in it

the comments.html template (along with submission.html) has numerous
undesirable properties which i will describe now. unless you are very
familiar with the codebase, it can be extremely difficult to grok.

this is pretty insane as there is nothing fundamentally complex about
the goal of comments.html: return a component that shows a username
and info, reports if any, comment content, and actions a user can
take.

this behemeoth was initially 886 lines in the old version of this
codebase, and this is with awards and a lot of other cruft removed.
anyway, the maintainability of this file is about on par with some
legacy application that keels over and dies if you sneeze vaguely
in its direction.

the nicest thing i can say about it is that it isn't currently
crashing.

anyway some of the problems include:

* large, splittable components, are not split into separate files.

this makes it incredibly difficult to find or make changes across
the template and makes it nearly impossible to find or change a
specific thing.

this is most easily exemplified in the modals, which should by all
accounts be separate templates, just inlined into comments.html.

* the nesting is oftentimes incorrect.

inexplicably, probably out of laziness from when the code was first
written, things will end up fully left aligned, while multiple layers
deep into a nesting context.

if an if statement or an endif is changed, it is *incredibly*
difficult to figure out where the error was. you can't trust the
nesting.

* multiple repeated checks for things that are always true.

this is probably a symptom of the above two problems but it's very
noticeable once you fix the nesting. for example there is a block
near the very top of the actions bar which checks for
parent_submission which effectively checks "is this in a post" (this
commit won't complain about parent_submission checks but i do have
opinions on those).

all of the action buttons further down the chain also check for
parent_submission, or even check inconsistently (by using if c.post)
within this context this is a completely unnecessary check in this
context.

while it is potentially useful (and in fact because #251 requires we
dismantle the assumption a little bit) to have these checks now, the
fact that they were initially added shows that when the code was all
initial written, there was little care into thinking about comment
state.

* mobile actions are duplicated and duplicated inline.

i actually do find it probably pretty hard to support this normally
given the codebase's DOM so whatever, duplicate the things, *but* if
we're going to do that, inlining it into the middle of an incredibly
long template is really difficult to comprehend as a design decision.

...anyway yeah this PR intends to fix these problems and enable work
to be done on #251. this is a "perfect is the enemy of good" commit.
it doesn't change much fundamental and is not intended to erase the
sins of the original file, but at least make it maintainable.

this also fixes a minor bug with #473 where the GIF modal was left
in by accident.
2023-03-09 06:59:56 -06:00
justcool393
4c6c375215 Comments: indent actions in a less insane way 2023-03-09 03:13:45 -06:00
justcool393
bfe8fb70f6
support infinite length posts and comments (fixes #229) 2023-02-25 04:18:30 -06:00
justcool393
872d9c613b
videos: remove video uploads lol 2023-02-17 21:26:40 -06:00
justcool393
1574c46d0a modmail: constantify user ID and fix bug where users can bypass modmail route checks
the random c.sentto == 2 magic numbers in the code is... pretty
unmaintainable and unless you were aware of who "2" was, it's hard to
know what's going on.

in addition, we force modmail to go through the modmail path instead of
letting users bypass validation checks.
2023-02-17 14:41:41 -06:00
Snakes
84e5c7c651
Merge branch 'frost' into feature-award-feature-flag 2023-02-11 23:41:41 -05:00
TLSM
9ade35d22f Eager load GET /comments ("All Comments")
Before vs after:

GET /comments
|----------|--------|--------|--------|--------|--------|------------|
| Database | SELECT | INSERT | UPDATE | DELETE | Totals | Duplicates |
|----------|--------|--------|--------|--------|--------|------------|
| default  |  167   |   0    |   0    |   0    |  167   |    154     |
|----------|--------|--------|--------|--------|--------|------------|

GET /comments
|----------|--------|--------|--------|--------|--------|------------|
| Database | SELECT | INSERT | UPDATE | DELETE | Totals | Duplicates |
|----------|--------|--------|--------|--------|--------|------------|
| default  |   13   |   0    |   0    |   0    |   13   |     0      |
|----------|--------|--------|--------|--------|--------|------------|
2023-02-10 14:07:37 -06:00
justcool393
5d6641c890 remove Comment.print() and Submission.print() functions
these functions i don't believe exist upstream and i guess were to
diagnose an issue with author_ids not being saved properly. anyway not
really useful now as if an author_id doesn't exist, some major db
corruption has prolly already happened.
2023-02-10 14:01:28 -06:00
justcool393
f8f55be8b0
constantify render depth limit 2023-02-10 13:54:49 -06:00
justcool393
fc81ed11bf awards: don't load JS if disabled 2023-02-09 10:16:15 -06:00
justcool393
a863b9c957 awards: remove vestiges of awards that don't exist anymore 2023-02-08 18:22:32 -06:00
TLSM
946ee6291d Hide flair if should_hide_username in comments
Fixes #497.
2023-02-08 14:49:27 -06:00
justcool393
97c9300a6f
volunteer: hide usernames and scores in volunteer (ref #454) 2023-02-07 07:04:24 -06:00
faul_sname
b75c93e600 Merge remote-tracking branch 'origin/frost' into themotte-issue-451 2023-01-12 22:09:07 -08:00
justcool393
712a0ad631 awards: remove tilt award 2023-01-08 19:38:20 -06:00
faul_sname
434542b586 [themotte/rDrama#451] Show the number of descendants on the "More comments" button 2023-01-06 18:27:23 -08:00
Ben Rog-Wilhelm
060e3967fd Minor tweak to usernote click handle. 2022-11-13 14:44:20 -06:00
Ben Rog-Wilhelm
dcf11531c1 Fix: One more spot with usernote leakage. 2022-11-13 14:38:23 -06:00
TLSM
3f360bb457 Remove special cases for unused awards.
Removes the following awards / fields on User:
 - flairlock
 - progressivestack
 - bird
 - longpost (pizzashill)
 - marseyawarded
 - rehab
 - deflector
 - mute
 - unmutable
 - eye (All-Seeing Eye)
 - alt (Alt-Seeing Eye)

Primarily motivated by starting to remove some un-Mottelike cruft
from core commenting/posting routes. Cleared out other inapplicable
awards while in the process.
2022-11-09 20:37:04 -06:00
TLSM
72995ef3f1 Fix #352: don't collapse comments when ?context.
While checking for the key in the Request object is highly inelegant,
it is consistent with how we determine elsewhere if rendered comments
are being shown as a context.
2022-11-06 03:13:10 -06:00
Inire
08a98429e0 Change hidden score placeholder from ? to empty string 2022-10-28 03:55:07 -05:00
Inire
4e2047624b Hide votes for posts and comments under 24 hours old 2022-10-27 21:50:08 -05:00
DinoInNameOnly
67a83ba0a8 Allow viewing the popup card 2022-10-07 13:53:37 -05:00
Ben Rog-Wilhelm
9939a382a3 Adjust starting color for colored comment bars 2022-09-26 03:32:51 -05:00
Julian Rota
563f3df7c5 Refactor reasons into a shared template 2022-09-26 03:07:48 -05:00
Julian Rota
0e5bf61d73 Add reasons to report screens 2022-09-26 03:07:48 -05:00
Ben Rog-Wilhelm
8cd6548620 Change bar coloring period to 8 and adjust colors. 2022-09-26 03:06:57 -05:00
Michael House
0bfbf17e45 Implemented collapse bar colorization on the server side 2022-09-23 22:11:55 -05:00
Ben Rog-Wilhelm
74cfce4c2e
Update visual theme to be cleaner and less cluttered. 2022-09-11 19:12:23 -05:00
TLSM
72b46a6888 Implement client-side collapsed comment memory.
Fixes #290. h/t Suspicious Turtle for initial implementation.
2022-09-09 19:47:26 -05:00
TLSM
48d5e92a25 Densify comment whitespace (low-hanging fruit).
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.
2022-09-08 05:09:41 -05:00
iro84657
2767d556ca Clean up handling of "view more comments" button 2022-09-07 17:30:18 -05:00
Ben Rog-Wilhelm
20fa9ce79f Move a bunch of moderation tools to admin level 2 2022-09-06 18:51:24 -05:00
TLSM
70c8a942b6 Remove games.
Unfortunately not totally dead code paths, and special case behavior
for them complicated commenting and sorting logic in a number of
places.
2022-09-05 23:44:18 -05:00
TLSM
3e8904757a Remove coins from popovers, disable coin routes.
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.
2022-09-05 23:44:18 -05:00
TLSM
e12b0eea1a Remove treasure rewards for comments.
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.
2022-09-04 19:12:30 -05:00
TLSM
a35697e55e
Replace nearly all ?v= cachebusts with assetcache.
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.
2022-08-30 17:02:46 -04:00
Ben Rog-Wilhelm
210d4d3bc1 Bump cachebusters 2022-08-22 22:14:21 -05:00