Commit Graph

89 Commits

Author SHA1 Message Date
925c17675f Add inline image expansion
Clicking an image will expand it.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 22:26:51 -07:00
0d6b6ca5b5 Add image hover
If a user hovers over an image with their mouse, it will load the image
and display it in the corner.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 22:02:51 -07:00
b646509f75 Update post information to come before the image info in a post
The post number, username, subject, etc all come before the an image (if
there is one) now, rather than sorta wedged afterwards. This seems to be
working.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 21:17:19 -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
5df21ccb95 Add poster name saving via cookie
When a user makes a new post with a name set, it will get saved via a
cookie to the user's client and it will automatically get set the next
time a user makes a post.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 20:28:21 -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
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
250ebe2b84 Add COPYING file
In case it wasn't clear - this work belongs to me and me alone. keep
your paws off

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 16:59:45 -07:00
7941acc224 Add ALLOWED_HOSTS file to gitignore
In tandem with the last commit, ALLOWED_HOSTS file is no longer tracked
by git.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 16:54:03 -07:00
8fef30b9c0 Move ALLOWED_HOSTS -> ALLOWED_HOSTS.example with some examples too
ALLOWED_HOSTS file is used in production to determine which hosts this
server is allowed to respond from. This has been moved to
ALLOWED_HOSTS.example with some example usage included. This is mostly
used to prevent accidentally committing and overwriting allowed hosts
used in production.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 16:51:44 -07:00
a38162a8df Fix up create*Window functions to be more mobile-friendly
I was surprised to see that the site is already pretty mobile-friendly.
The main issue was the quick reply, new thread, and report
windows - they were all hard-coded to be 500px, 500px, and 360px wide
respectively. Now, those hard-coded widths are the default but if the
viewport is thinner than that, the new window will size itself down with
some padding.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 16:48:21 -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
0de62aa63d Add overflow-wrap: break-word; to post_body CSS
This will cause long, unbroken posts to wrap.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-12 15:40:14 -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
e866cbae0f Update reply and post forms to display correct capcodes
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-07-01 18:41:40 -07:00
b791cf6a6b Update various windows that open to have their height automatically set
Some windows have a variable height based on the user's permissions
(e.g. having a capcode option). This sets the window height to the
minimum requiremed height based on the document loaded in.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-30 20:37:19 -07:00
76f641a935 Remove some more old winbox references
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-30 19:31:37 -07:00
376066e55f Remove old winbox reference
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-30 19:31:18 -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
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
61b9e2a277 Merge report_window.js into post.js
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-30 18:44:58 -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
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
2947ab6cf2 Add fontawesome
My kingdom for a sticky icon

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-30 15:46:54 -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
6ad2a72b86 Remove old winbox JS include from base.html
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-28 22:48:58 -07:00
66f6093f9b Remove old reply form code
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-28 22:14:42 -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
d931f52f01 Move off WinBox to JSFrame
WinBox is nice, but it has this annoying bug that I don't feel like
figuring out how to fix. JSFrame seems to work much better, although
centering the window seems to be a chore. I'll figure it out soon
enough.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-26 20:52:47 -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
fb61239147 Add JSFrame implementation for report window
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-25 21:05:31 -07:00
5239ec028d Remove winbox.js CSS rules
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-25 20:56:13 -07:00
4e60569cdc Fix blocktranslate issue in post_snippet.html
Can't use template filters, so this is fixed.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-25 20:51:56 -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
8ab760d456 Fix small type annotation bug
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-24 16:53:01 -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
412045e015 Convert templates to use translate instead of localize
Not sure what the difference is but most things tend to use translate.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-24 15:56:36 -07:00
e30012d6d0 Remove old openBanWindow function
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 23:01:26 -07:00
1f994dca3e Remove single line comment
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 23:01:05 -07:00
024f0c1290 Move openBanWindow to its own separate file
It is now shared between the admin view and the inline view.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 22:58:31 -07:00
4c5d8cee2a Add color vars to style.css and some winbox stuff
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 22:57:56 -07:00
8f9b27d5be Update order of the menu items
Report item gets added first in the menu now.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 22:30:56 -07:00
647aedfc67 Add in-line ban capabilities
Anyone with the ability to create bans can now do so via the drop down
menu on all posts.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 22:27:26 -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