Commit Graph

32 Commits

Author SHA1 Message Date
996e75dc2a Add news posts
You know. For basic information.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 23:01:51 -07:00
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
96e8b7752f Yet more unnecessary field removal
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 15:44:52 -07:00
a1483007b7 Remove unnecessary fields from boardview
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 15:42:27 -07:00
708e232e49 Remove unnecessary fields from PostView
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 15:36:17 -07:00
83533b5fb4 Add post and image deletion
This one was kind of a doozy. This also adds a custom 403 error page and
fixes some permission denied behavior that I was having issues with for
a while.

This is also set up in a way that hopefully will allow me to easily
implement user post deletion.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 15:19:20 -07:00
6ff64a3299 Rename {post_create,post_modify,reply_create}_view.html
This drops the _view suffix of each of these, makes it more consistent
and less of a chore to type.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-13 13:16:57 -07:00
b096f70751 Add BoardMixin, update can_modify
* BoardMixin adds a cached property that gets the current viewed board -
  this assumes that there is a self.kwargs["url"] value available.
* can_modify now checks for some more permissions.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 19:28:20 -07:00
e56832ab1b Fix some context values for can_modify in context
can_modify needs to be present in order to load the modify.js script.
This wasn't present on the PostView and was on a couple of unnecessary
views.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-30 18:52:44 -07:00
0ac383ce6c Update PostModifyForm to use permissions to create its fields
Fields are only displayed via the PostModifyForm if the user has
specific permissions to do things, like set stickies.

Also, add PostModifySuccessView that will close the modify window when
the process is complete.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-30 18:16:08 -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
6c11d210e8 Add floating window for new threads
New threads get a floating window just like new replies have. This only
pops up on the board detail view.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-28 23:55:44 -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
356196db26 Fix small bug with ban calculation
If a user had a permaban, there would be a comparison error between the
current time and the expiration time (none).

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-26 20:27:42 -07:00
e596d59e82 Trying out JSFrame for windows
Winbox has this annoying bug where you can't move the window below the
calculated area of the document, so you can't drag it over blank space.
JSFrame fixes this and does basically what we want as well. This has
been implemented for post replies and I am going to implement it for
reports and ban creation too.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-25 20:42:10 -07:00
a3bf5098ba Rename CreatePostView -> CreateView, add utils.is_banned
The artist formerly known as CreatePostView is a little more generic now
and outsources its ban check to a new util method, is_banned.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-24 16:50:46 -07:00
36f73a2d31 Add configurable report and ban window timeouts.
On the success page for bans and reports, the window can now be
configured to close after N seconds if desired.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-24 16:21:41 -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
5763c33f39 Bans are deleted when they expire after a user tries to post
If a user had a ban previously, range-ban or single IP, which has since
expired, they will not be redirected to the "you are banned" page and
the active bans are deleted.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-21 16:59:32 -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
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
57b4657353 Remove a couple of unused comments
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-07 16:34:53 -07:00
bd6a86169d Add redirect to page 1 from bare URL
Previously, you could browse /board/ and /board/page/1/ in the browser
and they would be the same thing. Now, /board/ redirects to
/board/page/1/ to keep things unambiguous.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-07 16:31:32 -07:00
994e4904a6 Add page count and links to bottom of board view
Current page shows up on the bottom of every board with next/prev links
where applicable.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-07 15:14:50 -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
771dba1515 Remove todo
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-06 22:03:21 -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