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>
This commit is contained in:
@@ -19,6 +19,7 @@ __all__ = (
|
||||
"BoardView",
|
||||
"PostView",
|
||||
"ReportView",
|
||||
"ReportSuccessView",
|
||||
)
|
||||
|
||||
|
||||
@@ -145,9 +146,6 @@ class ReportView(CreatePostView):
|
||||
form_class = ReportForm
|
||||
success_url = reverse_lazy("board:report_success")
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
return super(ReportView, self).get_context_data(**kwargs)
|
||||
|
||||
@property
|
||||
def board_url(self) -> str:
|
||||
return self.kwargs["url"]
|
||||
@@ -164,6 +162,15 @@ class ReportView(CreatePostView):
|
||||
return kwargs
|
||||
|
||||
|
||||
class ReportSuccessView(TemplateView):
|
||||
template_name = "board/report_success.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["window_timeout"] = settings.REPORT_WINDOW_CLOSE_TIMEOUT
|
||||
return context
|
||||
|
||||
|
||||
class BanCreateView(PermissionRequiredMixin, CreateView):
|
||||
model = Ban
|
||||
form_class = BanForm
|
||||
@@ -209,3 +216,8 @@ class BanCreateView(PermissionRequiredMixin, CreateView):
|
||||
class BanSuccessView(PermissionRequiredMixin, TemplateView):
|
||||
permission_required = "ban.create"
|
||||
template_name = "board/ban_success.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["window_timeout"] = settings.BAN_WINDOW_CLOSE_TIMEOUT
|
||||
return context
|
||||
|
||||
Reference in New Issue
Block a user