Commit graph

1036 commits

Author SHA1 Message Date
Ben Rog-Wilhelm
8942046a1c Fix: Null reference when sending messages through a non-comment window. 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
0e8856ee46
combine postToast variants (#648) 2023-07-28 05:05:47 -05:00
justcool393
48d7f4077d using optional chaining seems to break older browsers
https://caniuse.com/mdn-javascript_operators_optional_chaining

it seems to be less supported on mobile devices then I'd expect so
here's a justification for it i guess

reported here: https://www.themotte.org/post/563/meta-a-whole-host-of-minor/122837
2023-07-27 11:22:44 -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
672745ee6c
combine 5 different post/comment filter state adjustment routes (#637) 2023-07-22 19:34:08 -05:00
TLSM
fdc6fa4181 fix: username popover listener on comment reply
Fixes #612. Ports in an existing working fix from upstream with
the change to bs_trigger. Also a stylistic improvement on the
preceding line I noticed while porting it.

bs_trigger is what attaches the event listeners for the Boostrap
popovers. It wasn't being called on the new elements, so they get no
user card. It is now, so it does. Calling it on the comment form
element doesn't work here because, unlike in an earlier stage of the
codebase (which I think the fork occured during the transition of)
put replies into a dedicated element rather than replacing the reply
form.
2023-07-09 13:38:29 -05:00
Ben Rog-Wilhelm
2f0a3fc278 Terminology change: instead of "banning" comments or posts, remove them. 2023-06-23 22:32:11 -05:00
Ben Rog-Wilhelm
52bcb85950 Clean up remove/approveCommentDesktop2 functions into something a little more comprehensible. 2023-06-16 12:45:29 -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
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
Snakes
84e5c7c651
Merge branch 'frost' into feature-award-feature-flag 2023-02-11 23:41:41 -05:00
justcool393
1817008a91
remove profile songs (ref #470) (#499)
* removes profile songs (ref #470)

* Remove ffmpeg, remaining song subsystem

  - Remove references to User.song in userpage* templates
  - Generate migration to drop column
  - Remove ffmpeg dependency in Docker

* remove python 2 era __future__ import

---------

Co-authored-by: TLSM <duolsm@outlook.com>
2023-02-10 13:56:04 -06:00
justcool393
a863b9c957 awards: remove vestiges of awards that don't exist anymore 2023-02-08 18:22:32 -06:00
justcool393
9ee7b73929 fix scrolling bug (#279)
ref: f7ca9aa24822d8361fd6fa939c0492711629682b on Aevann1/rDrama
2023-01-25 08:39:46 -06:00
justcool393
a213396854
Solve blocking weaponization.
* allow anyone to reply to their blockers

* revert userblocks thing

* get rid of unnecessary template

* make blocking page accurate

* comment author things

* fix prev commit

* fix block page

* comma splice

Co-authored-by: Snakes <104547575+TLSM@users.noreply.github.com>
2022-12-17 11:11:51 -06:00
justcool393
0c632d73b7
Rework error system a bit to remove a bunch of duplicated code (#434) 2022-12-01 20:58:27 -06:00
Ben Rog-Wilhelm
08602b4279 Volunteer Janitor: Minor cleanups. 2022-12-01 18:53:24 -08:00
Ben Rog-Wilhelm
0f74f6a4e2 Volunteer Janitor: Warn on page exit. 2022-12-01 18:53:24 -08: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
Inire
08a98429e0 Change hidden score placeholder from ? to empty string 2022-10-28 03:55:07 -05:00
Inire
0991dc7ed2 Fix a bug where voting shows NaN when voting on a post or comment with a '?' score 2022-10-28 03:01:18 -05:00
Ben Rog-Wilhelm
bf116115e2 Fix: Reporting comments is broken. 2022-09-27 18:43:20 -05:00
Julian Rota
0e5bf61d73 Add reasons to report screens 2022-09-26 03:07:48 -05:00
Michael House
0bfbf17e45 Implemented collapse bar colorization on the server side 2022-09-23 22:11:55 -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
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
dbaf0a1bfd Remove unused polls code to reduce query volume.
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.
2022-09-05 23:44:18 -05:00
Julian Rota
cf9819ca5b Hide the reply section after submitting a response 2022-09-05 12:03:16 -05:00
TLSM
0b332e31bf Fix timestamp tooltips not appearing.
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.
2022-08-27 06:15:38 -05:00
Ben Rog-Wilhelm
280e7275a6 Rejigger theme pretty heavily. I apologize for this change not being neatly split apart in any way. 2022-08-22 22:02:39 -05:00
Julian Rota
f2d657811f Fix the other report button for posts on the comments page 2022-08-19 03:18:35 -05:00
TLSM
4cfd1d5a5b
Fix 2FA modal not displaying in UI (#178). (#180)
Fixes issue #178. Root cause was attempting to document.getElementById
of both modal and toggle input before both were loaded into the DOM.
In the upstream, Cloudflare's Rocket Loader is used, which papers over
many cases of inattention to loading order.
2022-08-16 22:38:19 -05:00
painejohn
defe23ea16
Update comment reply css + clear preview as well (#158)
This basically extends the CSS changes from
https://github.com/themotte/rDrama/pull/150 to also cover comment
_replies_ and then updates the JS from
https://github.com/themotte/rDrama/pull/153 to also reset the comment
reply preview div back to default after posting the comment reply.
2022-08-10 06:04:54 -05:00
painejohn
cbcc2aac6f
139: Disabled multimedia embedding
This change disables multimedia embedding:

- In comments and comments replies.
- In new submissions.
- In comment & submission preview

And it's all toggle-able via an envvar, except for the JS bits,
but I linked those to the github issue, so should be easy to find
in the future.

The way it works is:

- removes markdown image/video syntax,
  eg. `![](https://example.org/someimage.jpg)` into ``
- changes link text into anchors, eg.
  `https://example.org/someimage.jpg` into
  `[https://example.org/someimage.jpg](https://example.org/someimage.jpg)`
- removes html img/video/audio tags, eg.
  `<img href="https://example.org/someimage.jpg" />` into ``
- when embedding gifs via the giphy modal in "new submission", it will
  insert only an anchor to the gif
- when attaching an image, it will upload the image, then add only an
  anchor to the post/comment body

I tested this manually, but not sure if I got all the test cases. What I
checked was:

- create comment w/ image/video/audio media using markdown -> success
- create comment reply w/ image/video/audio media using markdown ->
  success
- create comment w/ link to img/imgur/youtube/audio -> success
- create comment w/ attachment -> success
- create comment reply w/ attachment -> success
- create comment w/ img/video tag -> success
- create comment reply w/ image/video tag -> success
- create post submission w/ image/video/media using markdown -> success
- create post submission w/ link to img/imgur/youtube/audio -> success
- create post submission w/ attachment -> success
- create post submission w/ giphy gif -> success

Also, updated the formatting page.

Co-authored-by: Ben Rog-Wilhelm <zorba-github@pavlovian.net>
2022-08-07 01:30:47 -05:00
painejohn
8463a9ebbe
135 - Posting a comment clears out comment textarea & preview 2022-08-07 01:17:46 -05:00
Ben Rog-Wilhelm
800ae8d2dc Split SITE_NAME into computer-readable SITE_ID and human-readable SITE_TITLE. 2022-07-31 18:53:18 -05:00
JulianRota
f495981a5e
Merge pull request #122 from zorbathut/pr_fixvote
Fix voting.
2022-07-26 23:19:33 -04:00
Ben Rog-Wilhelm
0082434458 Fix voting. 2022-07-23 04:41:47 -05:00
Julian Rota
81610b803a Support settings for integers and allow setting filter settings in UI 2022-07-09 06:33:41 -05:00
Julian Rota
bd5fd8fb21 Switch over comment reporting to use the new system 2022-07-09 06:33:41 -05:00
Julian Rota
a0488f2b23 UI to allow update of comment filter status 2022-07-09 06:33:41 -05:00
Michael House
db185a9ef2
Fixed reply-twice bug on submission page. 2022-06-29 00:25:11 -05:00
Michael House
715d402a11 Merge branch 'frost' into fix_profile_image_performance 2022-06-08 07:18:37 -05:00
Julian Rota
1e0aa4ee22 Merge branch 'frost' into new-user-filtering 2022-06-06 14:56:28 -04:00
Michael House
e63a021c61 Added mentions to the markdown preview 2022-06-06 06:09:42 -05:00
Michael House
03aa2ca48e Added spoiler extension to the marked.js markdown preview 2022-06-05 15:56:11 -05:00
Michael House
bce168c295 Added purify for html sanitization 2022-06-05 10:58:17 -05:00
Michael House
bce836bf81 First stab at resolving html entities not being rendered 2022-06-05 10:37:09 -05:00
Michael House
f3f2aa3935 Made a lot of small changes in the frontend 2022-06-04 07:48:26 -05:00