Commit graph

15868 commits

Author SHA1 Message Date
Ben Rog-Wilhelm
86fe498138
Merge pull request #549 from justcool393/fix-leaking-deleted-content
fix leak of deleted content
2023-03-14 12:48:55 -05:00
justcool393
8e62f1440b make this also work for not logged in users 2023-03-14 12:15:52 -05:00
justcool393
d09e1d4eb8 let users see their own content 2023-03-14 12:11:12 -05:00
justcool393
24af1b4433 fix leak of deleted content 2023-03-14 12:05:25 -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
54fdfd1559 sticky api url 2023-03-11 03:03:41 -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
fb65cf0416
privatize user CSS (fixes #273)
implements issue comment: https://github.com/themotte/rDrama/issues/273#issuecomment-1240543608
2023-02-25 04:51:06 -06:00
justcool393
d0ba568738 classes: use self.__class__.__name__ in __repr__ 2023-02-25 04:21:33 -06:00
justcool393
bfe8fb70f6
support infinite length posts and comments (fixes #229) 2023-02-25 04:18:30 -06:00
justcool393
44919507e9
leaderboard refactor (#526) 2023-02-24 06:31:17 -06:00
justcool393
22ad4f5d23
sanitize: sanitize raw content (fixes #214) 2023-02-24 06:00:19 -06:00
justcool393
ce04999fb2
remove more auth desireds on some routes
no need for the user at all here
2023-02-24 05:57:35 -06:00
justcool393
ff09ba4209 SQLA migration: fix RemovedIn20Warnings 2023-02-24 05:54:56 -06:00
justcool393
449e2557d0 fix unstickying 2023-02-20 18:10:40 -06:00
justcool393
872d9c613b
videos: remove video uploads lol 2023-02-17 21:26:40 -06:00
justcool393
0f10e1ea16 SQLA2 migration: default SQLALCHEMY_WARN_20 to 1 2023-02-17 17:50:11 -06:00
justcool393
f155578633 fix missing import used by error handler 2023-02-17 14:43:04 -06:00
justcool393
9f7e7ef980 oauth: fix length constraints 2023-02-17 14:42:37 -06:00
justcool393
a8013f1089 fix api comments (fixes #512) 2023-02-17 14:42:06 -06:00
justcool393
50b6e06f62 Modmail: constantify missed magic numbers 2023-02-17 14:41:41 -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
justcool393
81cfc09fed simplify seed_db 2023-02-17 14:41:06 -06:00
Ben Rog-Wilhelm
860eea7ba8
Merge pull request #517 from justcool393/comment-reply-sort
Sorting: add comments sort for comments and constantify sorts
2023-02-17 14:39:34 -06:00
justcool393
6c2876ea6b no t 2023-02-17 01:00:38 -06:00
justcool393
340644a3ae default 2023-02-17 00:49:04 -06:00
justcool393
009918f954 Remove <pre></pre> bs 2023-02-17 00:44:21 -06:00
justcool393
7e93ea6361 fix indentation and logic error 2023-02-17 00:40:17 -06:00
justcool393
e8d2f2bce2 missing %endif% 2023-02-17 00:33:36 -06:00
justcool393
d8c12ff794 translate transformY 2023-02-17 00:30:08 -06:00
justcool393
9ca1fa6935 ccmode 2023-02-17 00:23:57 -06:00
justcool393
97359602b4 fix braindead mistake 2023-02-16 23:59:35 -06:00
justcool393
22741fce1f remove unnecessary classes and ids 2023-02-16 23:56:23 -06:00
justcool393
f8ed83a696 explicit context passing 2023-02-16 23:50:48 -06:00
justcool393
c5cea4f8fa add SORTS_COMMENTS 2023-02-16 23:43:08 -06:00
justcool393
95d68d013d Remove dead code 2023-02-16 23:11:14 -06:00
justcool393
31e14d896f Errors: fix missing error handler for 409 2023-02-16 19:55:23 -06:00
justcool393
9453a5d074 Fix search page 2023-02-16 18:54:34 -06:00
justcool393
31f273ca32 Pins: fix infinite recursion 2023-02-16 18:46:43 -06:00
justcool393
d728a16a19 Fix :pepodroll: 2023-02-16 18:30:03 -06:00
justcool393
ba96decb9b Jinja2: add SORTS_COMMON and SORTS_ALL 2023-02-16 18:27:16 -06:00
justcool393
384b4fbd22 . -> ~ 2023-02-16 18:25:18 -06:00
justcool393
09308f17d1 Add keyword argument pins to sort_comment_results 2023-02-16 18:17:21 -06:00
justcool393
9ba4f1a8af Remove unnecessary DESC constant 2023-02-16 18:02:26 -06:00
justcool393
5f73302b28 Sorting: add comments sort for comments and constantify sorts 2023-02-16 17:52:43 -06:00
Ben Rog-Wilhelm
0af172d173
Shift a bunch of root-directory files into a new less-cluttered bootstrap directory. 2023-02-15 14:54:09 -06:00