Add bumplock to post modify form, and add set_bump permission

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-06-30 18:42:16 -07:00
parent 0ac383ce6c
commit 638d8cd349
3 changed files with 8 additions and 8 deletions

View File

@@ -127,7 +127,7 @@ class PostModifyForm(ModelForm):
model = Post
# we specify fields up here too because otherwise they won't be
# recognized by the form to update values
fields: list[str] = ["sticky"]
fields = ["sticky", "bump"]
def __init__(self, *args, user, **kwargs):
super(PostModifyForm, self).__init__(*args, **kwargs)
@@ -135,6 +135,8 @@ class PostModifyForm(ModelForm):
fields = []
if self.user.has_perm("board.set_sticky"):
fields += ["sticky"]
if self.user.has_perm("board.set_bump"):
fields += ["bump"]
# NOTE:
# We do *not* need to check permissions against these fields we're
# setting down here in the self.clean() function in the case that a