Commit graph

1221 commits

Author SHA1 Message Date
gldrk
1949eacee4
Add reply container for comments at depth limit 2023-11-26 19:20:39 +00:00
Walter Miller
52268047b3 adjust whitespace in comments.html 2023-11-08 04:12:39 -06:00
Ben Rog-Wilhelm
ae85dcce99
Fix: No button for replying to PM's. (#673) 2023-08-09 03:07:04 -05:00
Ben Rog-Wilhelm
bc9c59c92c Fix: Javascript filename typo. 2023-08-06 22:35:11 -05:00
justcool393
0138596dca fix remove/approve buttons not working from listing page 2023-07-28 16:18:47 -05:00
justcool393
2d6c844693 fix usernote button not working on morecomments and viewmore
fixes #284
ref #283
2023-07-28 05:17:14 -05:00
justcool393
a5e658ea42 fix deep comment reply hang
fixes #594
2023-07-28 05:14:27 -05:00
justcool393
a5a344f084
fix duplicate ~new~ indicators being sent (#642)
we also make the JS we're generating about 7% the size it was before.
2023-07-22 19:52:09 -05:00
justcool393
c8964b272e use permissions constant instead of literal 2 2023-07-20 20:18:48 -05:00
justcool393
db1f578f26 simplify visibility states using the new visstates
because of #606, we now have a relatively decent way of representing
how post/comment state is in the database. we'll use this in our code
which is used to determine what is shown in the UI
2023-07-13 14:13:13 -05:00
TLSM
6fde14a92c Use reddit-style notifs without context
The notifications schema is already set up for reddit-style
chronological notifications. We simply have to remove the logic that
builds the context and patch up a few places in the frontend that
were expecting full reply trees.

`Comment.header_msg` previously expected the user's own comment to
be top-level in comment replies. Logic is revised to expect the actual
reply.

`files.routes.front.notifications_main` now has reduced query volume
because we aren't expiring the session when marking notifications read.
This also allows us to remove the unused `comms` variable, which is a
makeshift "pattern" of storing duplicate database replies across a
commit so the templates don't requery (thus losing data attached to
the runtime object, like `c.unread` / `c.notif_utc`).

We move the `is_notification_page` flag to the route callers rather
than templates checking `request.path`.

Minor UI style: "Clear all notifications" -> "Mark All Read", since
this was a persistent point of user confusion upstream, with people
expecting their inbox to empty out. Also less margin between notifs
to be consistent with tighter comment display elsewhere and removed
need to separate groups of comments vs single comments.
2023-07-12 00:24:50 -05:00
Ben Rog-Wilhelm
ccf809406e Rejigger the Mod/Report state system. 2023-07-01 21:06:40 -05:00
Ben Rog-Wilhelm
5271e7c943 Move 'deleted_utc' into 'state_user_deleted_utc' and change types. 2023-06-23 21:30:19 -05:00
rudyon
063e8087a5
enhancment: Add ~new~ text to the header of new posts (#589) 2023-05-13 11:21:06 -05:00
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