Commit graph

3777 commits

Author SHA1 Message Date
TLSM
ecbd8179b9 Fix #238: remove "Get Them Help" button. 2022-09-05 00:44:13 -05:00
TLSM
2077ac4f83 Port in valid RSS feed creation from upstream. 2022-09-05 00:44:13 -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
b31e1874dd Fix #230: present pinned posts first in all sorts. 2022-09-04 19:11:42 -05:00
JulianRota
9657adbebf
Merge pull request #227 from TLSM/rework-assets
Rework assets to use automatic cachebusting (#127).
2022-09-01 00:28:39 -04: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
TLSM
b2773cbb40
Clarify permabanned forbidden messages.
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.
2022-08-30 13:35:02 -04:00
TLSM
e1244e9496 Fix flask-limiter having null limit_key.
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
2022-08-30 06:37:56 -05:00
Julian Rota
27d48226de Remove lack of comment count increment if comment is a reply to self 2022-08-29 14:16:49 -05:00
Ben Rog-Wilhelm
de4d923b32 Fix some mod log errors and make it more durable to future changes. 2022-08-27 11:23:12 -05:00
Julian Rota
2d03dd1984 Remove remaining gumroad stuff 2022-08-22 09:54:35 -05:00
Jack Byrne
2adf38a377 Only show /leaderboard link in settings2 menu to admins, also a more polite 403 message, also more readable HTML 2022-08-21 01:44:56 +01:00
Jack Byrne
6b53867ae1 Post validation: better length validation for post submissions 2022-08-19 04:19:41 -05:00
TLSM
965a4dc157 Fix improper calls to Comment.replies.
In four contexts, Comment.replies(.) was not updated to reflect the
interface changes with comment filtering. This directly caused #170
and #172 (which was a stack trace from the former).
  - Updating notifications for DMs (routes/users.py L690)
  - Updating notifications for modmail (routes/users.py L729)
  - morecomments for logged out users (routes/posts.py L421)
  - JSON for API access (classes/comment.py L347)

All four contexts seem to behave correctly after the change. However,
strictly speaking the JSON generation will not include a user's own
filtered or removed comments, though this is hard to remedy without
passing the user object `v` to json_core. Propagating that through the
codebase seems a worse option than leaving it as is.
2022-08-17 14:01:31 -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
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
Julian Rota
850d175563 Fix editing posts 2022-07-31 17:22:43 -05:00
JulianRota
cc85b28288
Merge pull request #123 from zorbathut/pr_linearvote
Make downvotes actually reduce user karma.
2022-07-29 10:17:18 -04:00
painejohn
0e165e17c0 Fixes #110 "Signout doesn't always work"
I tried reproducing the issues from #110 but without luck. The
workflow looks a little like this:

- User changes their avatar.
    - This triggers a POST request to the profile endpoint.
- User clicks "Log out" from the dropdown menu"
    - This triggers the post_toast function in js that makes a POST to
      /logout, which clears the user's session. Then, on receipt of the
      response, the js calls `location.reload`, which replays the
      browser's last action, which in our case is the earlier POST
      request to the profile endpoint. This is why the browser asks
      whether it's OK to resubmit the data _again_. Agreeing resubmits
      the first POST request.
    - After `location.reload`, since the user is no longer logged in,
      they either get a 405 (from the profile edit page) or a 500 (from
      the profile overview page).

This PR then changes the `/logout` endpoint from POST to GET, then
updates the header template to change the "Log out" anchor to simply
link to "/logout" instead of calling any js.

Reasoning behind it:
- logout doesn't modify server-side resources, so it's safe to make it a
  GET request.
- Making it a GET prevents the browser from ever displaying the "data
  resubmit" warning window.
- The "/logout" endpoint can now simply redirect to the homepage.
2022-07-29 06:47:19 -05:00
JulianRota
7c86c88c68
Merge pull request #121 from zorbathut/pr_hidevotes
Hide vote details from non-admins.
2022-07-26 23:16:08 -04:00
Ben Rog-Wilhelm
2595ed7fc0 Remove dead references to DEFAULT_IMAGE. 2022-07-26 03:35:55 -05:00
Ben Rog-Wilhelm
42412ed40b Redesign the comment/post voting code and properly support standard votes. 2022-07-24 04:37:44 -05:00
Ben Rog-Wilhelm
17d550f00e Make downvotes actually reduce user karma. 2022-07-23 05:52:54 -05:00
Ben Rog-Wilhelm
19e9c1a20e Hide vote details from non-admins.
It is intentional that the links show up on admin level 2 but aren't usable until admin level 3; I don't know what I want right now and I want to encourage admins to pester me about it.
2022-07-23 03:04:43 -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
Julian Rota
4b0c4fcc73 Add page for filtered comments 2022-07-09 06:33:41 -05:00
Julian Rota
4ecb4747c1 Filter on user pages too 2022-07-09 06:33:41 -05:00
Julian Rota
f736d660b6 Filter on other pages as well 2022-07-09 06:33:41 -05:00
Julian Rota
ba9689f017 Working on hiding filtered comments 2022-07-09 06:33:41 -05:00
Julian Rota
d1d7071304 Set comment filter status based on settings 2022-07-09 06:33:41 -05:00
Julian Rota
3c2871dd0f Set filter status badly so commenting works again 2022-07-09 06:33:41 -05:00
Michael House
9fef790629 Added caching to /@username/pic endpoint, other small fixes 2022-06-09 05:36:45 -05:00
Michael House
715d402a11 Merge branch 'frost' into fix_profile_image_performance 2022-06-08 07:18:37 -05:00
Michael House
ea98d51fb2 Refactored path building and caching on /pp/ route 2022-06-08 06:53:15 -05:00
Michael House
658eacb45d Partial fix for performance issues with mentions 2022-06-07 15:30:27 -05:00
Julian Rota
1e0aa4ee22 Merge branch 'frost' into new-user-filtering 2022-06-06 14:56:28 -04:00
Michael House
e7c7fba0ad Fixed 404 on random user button and changed icons 2022-06-05 17:02:34 -05:00
Michael House
f3f2aa3935 Made a lot of small changes in the frontend 2022-06-04 07:48:26 -05:00
Julian Rota
68b10ff3f8 Add a site setting for the post filtering feature 2022-05-24 00:13:33 -04:00
Julian Rota
b6f068645d Retrieve reported post list by status instead of by reports 2022-05-23 22:58:06 -04:00
Julian Rota
0a67c0138f Support setting ignored status 2022-05-23 22:57:23 -04:00
Julian Rota
16cc7ae6f6 Set reported status when reported and not ignored 2022-05-23 22:54:53 -04:00
Julian Rota
4b6aa40960 No more removing reports 2022-05-23 00:35:26 -04:00
Julian Rota
0002f66f36 Merge branch 'frost' into new-user-filtering 2022-05-22 17:01:45 -04:00
Michael House
d9b348a3ca Changed default profile url from emoji 2022-05-22 11:02:09 -05:00
Michael House
ddb1523bde Fixed a merge conflict that I somehow missed and removed marsey images from seed db 2022-05-22 08:27:13 -05:00
Michael House
82a18e5cad Up-merged and resolved conflicts in routes/login.p and routes/votes.py 2022-05-22 08:23:59 -05:00
FatherInire
fcba426009
Remove some gimmicky r/drama features.
Co-authored-by: Inire <>
2022-05-21 21:43:00 -05:00