Commit Graph

32 Commits

Author SHA1 Message Date
a4f00e6242 Add user post deletion
Users can delete their posts as long as they don't clear their cookies,
and as long as server-side user sessions are persistent.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 21:28:07 -07:00
f54337a139 Add report cooldowns
This is to prevent report flooding/spamming.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 13:06:33 -07:00
f04604ce69 Users may only report a post once per IP address.
If a user *really* doesn't like a post, they may try to report it
multiple times. Users may now only report a single post once per IP
address.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 12:35:57 -07:00
c8fd8ffa89 Update Post.get_absolute_url() to always include the post ID
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 21:16:38 -07:00
3f1615f058 Add post count, image count, and unique posters to post detail
Just like 4chan has!!!!!!!

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 21:12:16 -07:00
d3e1f5a978 Add board locking, update tests, and update clean() methods
* Boards can be locked from allowing posts - this is can be useful for
  things like archived boards or locking down in the event of an
  emergency
* Some validation checks for new posts are from the reply/thread form to
  the Post model's clean() method
* Add some new tests, I've really been falling behind on those

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 18:30:16 -07:00
1eb960cb23 Limit post max length to 2k instead of 10k
10k is a little too long for this style of social media.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 15:42:59 -07:00
a3ebf75e83 Add thread locking and permissions
Mods can lock threads from replying now. Yay!

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-08 21:55:25 -07:00
bbe0765f38 Prevent bumping a thread when it's stickied
This prevents all stickied threads from having their own bump order. We
want stickies to all stay in the same order.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-30 18:58:43 -07:00
638d8cd349 Add bumplock to post modify form, and add set_bump permission
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-30 18:42:16 -07:00
6f99472f16 Add post modify view
This allows moderators to modify posts (add sticky, etc).

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-30 16:21:36 -07:00
ab749359fa Add admin capcodes
Sometimes, it is necessary for an admin or other moderator to reveal
themselves. Capcodes allow them to do so by appending a special colored
portion at the end of their name on a post.

This adds object-level permissions, so if you have a moderator who
shouldn't be able to use the "admin" capcode, you can give them
permission only to the "moderator" capcode.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-28 21:37:45 -07:00
29dff20db9 Add django-guardian for object-level permissions
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-26 21:30:45 -07:00
1e61522f7a Delete posts after a ban is created for them
After a user is banned for a post, that post now gets deleted. There's
no way to turn this off yet.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 21:49:04 -07:00
a5510d9552 Add board selection to ban creation and post ID to ban model
* Board selection is allowed for when you want to make a global ban
* Post ID is added to ban model for referencing later

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 18:57:23 -07:00
b64559aba9 Add report record admin and template search
When creating a ban, you can type in to do a search, this is useful for
quickly banning users.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 18:16:00 -07:00
470a10d2a7 Add ability to create bans from reports
This is done in the admin view and opens a new iframed window. The ban
form is pretty barebones and doesn't have full functionality yet, but
that is coming.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 16:03:09 -07:00
28ccd7d73b Add IP bans
Users can be banned by IP address now, either by singular IP or in an IP
range. If they are banned and attempt to post, they will be met with a
"you are banned until X date" screen.

There are a few loose threads with this, and IP bans may be obsolete if
I decide to go the accounts-required-for-posting route. But I think this
is a good start for 4chan style posting.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-20 15:26:35 -07:00
b4df8b9756 Fix report form to use appropriate templates
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-19 22:41:02 -07:00
daeb7849e8 Set report's reason to cascade deletion if the reason is deleted
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-19 22:14:59 -07:00
6bda7f4f2d Big upheaval of how the reports system works
* There are now Reports and ReportRecords.
* Reports coordinate to what moderators see, and ReportRecords
  coordinate with the reports that are created by individual users.
* Reports keep track of the report reason and the creating user.
* ReportRecords keep track of the total weight and whether this report
  requires urgent attention or not.
* ReportRecord keeps track of its own weight and urgency because then we
  can sort by weight and urgency in the admin view.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-19 22:03:01 -07:00
b838663d50 Add preliminary report system
The report system is pretty low-tech. However the scaffolding is there
for a lot of new stuff. What we currently have:

* Users can create reports
* Staff can view reports
* Admins can create report templates

There's a post drop-down menu available on all posts now, too. This is
where "report post" menu item lives and other things like that can be
added too.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-14 14:56:50 -07:00
2940affae3 Add reports, report reasons, bans, and ban templates
Reports are created by users.

Bans are created by moderators, in response to reports.

Report reasons and ban templates are created by admins, which give a
template for reports sent and bans issued.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-07 17:39:40 -07:00
fe8ea04d18 Add support for i18n and l10n
The majority of the words on the site are user-generated, but I've tried
to surround everything else with localization calls. I don't know
another language so this will have to do until someone decides to
translate it lol

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-07 14:19:06 -07:00
bce5e6cdf6 Add sage-like functionality a la 4chan
When reply to a post, you can uncheck "bump" and it will not bump the
thread to the top of the board.

This is useful for the OP, too, because it allows for "permasage"
functionality which is useful for moderators.

Finally, there is also "autosink" functionality. After a per-board
threshhold of posts, a thread will stop bumping.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-07 13:52:56 -07:00
efc1845aa0 Update TODO comment
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-07 13:36:52 -07:00
4e5203c61b Add check to prevent completely blank posts
This isn't perfect, but if a user tries to make a completely blank post,
they will be blocked from doing so

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-07 13:30:12 -07:00
3a35a35caf Add posting cooldown
If a user tries to post more than once in a certain amount of time, they
will be blocked from doing so until their cooldown is over. This
required a little bit of hacking to get the board and IP address set
*before* the validation checks were made, but it all appears to work.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-07 13:24:43 -07:00
27045c11c2 Add thread pruning for threads that pass the maximum page threshhold
Each board is allowed a number of threads per page, and a maximum number
of pages (default 10 for both). If a thread falls off the last page, it
is deleted.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-06 22:00:54 -07:00
6ed47f9957 Add max image upload size limit
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-04 21:14:00 -07:00
e6c60ff93c Add image upload support
Images can be uploaded, thumbnails are created, they're displayed within
the threads themselves. Just like four chans!

There is not an upload size limit set yet. Gotta get on that next.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-04 19:45:36 -07:00
126db039e2 Initial commit
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-03 18:02:04 -07:00