You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by gc...@apache.org on 2022/06/02 20:40:32 UTC

[allura] branch master updated: On forums, use a 404 page instead of redirecting to a "deleted" page

This is an automated email from the ASF dual-hosted git repository.

gcruz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/master by this push:
     new e6326e5f1 On forums, use a 404 page instead of redirecting to a "deleted" page
e6326e5f1 is described below

commit e6326e5f1096eab5fe11a6e10977998cc9782706
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Thu Jun 2 16:30:17 2022 -0400

    On forums, use a 404 page instead of redirecting to a "deleted" page
---
 .../forgediscussion/controllers/forum.py           | 14 ++++-------
 .../templates/discussionforums/deleted.html        | 27 ----------------------
 2 files changed, 5 insertions(+), 36 deletions(-)

diff --git a/ForgeDiscussion/forgediscussion/controllers/forum.py b/ForgeDiscussion/forgediscussion/controllers/forum.py
index 11c1cae03..9d7e343a2 100644
--- a/ForgeDiscussion/forgediscussion/controllers/forum.py
+++ b/ForgeDiscussion/forgediscussion/controllers/forum.py
@@ -105,7 +105,7 @@ class ForumController(DiscussionController):
                    limit=validators.Int(if_empty=None, if_invalid=None)))
     def index(self, threads=None, limit=None, page=0, count=0, **kw):
         if self.discussion.deleted:
-            redirect(self.discussion.url() + 'deleted')
+            raise exc.HTTPNotFound()
         limit, page, start = g.handle_paging(limit, page)
         if not c.user.is_anonymous():
             c.subscribed = M.Mailbox.subscribed(artifact=self.discussion)
@@ -122,10 +122,6 @@ class ForumController(DiscussionController):
             limit=limit,
             page=page)
 
-    @expose('jinja:forgediscussion:templates/discussionforums/deleted.html')
-    def deleted(self):
-        return dict()
-
     @expose('json:')
     @require_post()
     @validate(W.subscribe_form)
@@ -169,7 +165,7 @@ class ForumThreadController(ThreadController):
                    limit=validators.Int(if_empty=25, if_invalid=25)))
     def index(self, limit=25, page=0, count=0, **kw):
         if self.thread.discussion.deleted and not has_access(c.app, 'configure')():
-            redirect(self.thread.discussion.url() + 'deleted')
+            raise exc.HTTPNotFound()
         c.thread_subscription_form = self.W.subscribe_form
         return super().index(limit=limit, page=page, count=count, show_moderate=True, **kw)
 
@@ -180,7 +176,7 @@ class ForumThreadController(ThreadController):
     def moderate(self, **kw):
         require_access(self.thread, 'moderate')
         if self.thread.discussion.deleted and not has_access(c.app, 'configure')():
-            redirect(self.thread.discussion.url() + 'deleted')
+            raise exc.HTTPNotFound()
         args = self.W.moderate_thread.validate(kw, None)
         tasks.calc_forum_stats.post(self.thread.discussion.shortname)
         if args.pop('delete', None):
@@ -222,7 +218,7 @@ class ForumPostController(PostController):
     @utils.AntiSpam.validate('Spambot protection engaged')
     def index(self, **kw):
         if self.thread.discussion.deleted and not has_access(c.app, 'configure')():
-            redirect(self.thread.discussion.url() + 'deleted')
+            raise exc.HTTPNotFound()
         return super().index(**kw)
 
     @expose()
@@ -231,7 +227,7 @@ class ForumPostController(PostController):
     def moderate(self, **kw):
         require_access(self.post.thread, 'moderate')
         if self.thread.discussion.deleted and not has_access(c.app, 'configure')():
-            redirect(self.thread.discussion.url() + 'deleted')
+            raise exc.HTTPNotFound()
         tasks.calc_thread_stats.post(self.post.thread._id)
         tasks.calc_forum_stats(self.post.discussion.shortname)
         super().moderate(**kw)
diff --git a/ForgeDiscussion/forgediscussion/templates/discussionforums/deleted.html b/ForgeDiscussion/forgediscussion/templates/discussionforums/deleted.html
deleted file mode 100644
index 3ec3b398e..000000000
--- a/ForgeDiscussion/forgediscussion/templates/discussionforums/deleted.html
+++ /dev/null
@@ -1,27 +0,0 @@
-{#-
-       Licensed to the Apache Software Foundation (ASF) under one
-       or more contributor license agreements.  See the NOTICE file
-       distributed with this work for additional information
-       regarding copyright ownership.  The ASF licenses this file
-       to you under the Apache License, Version 2.0 (the
-       "License"); you may not use this file except in compliance
-       with the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing,
-       software distributed under the License is distributed on an
-       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-       KIND, either express or implied.  See the License for the
-       specific language governing permissions and limitations
-       under the License.
--#}
-{% extends g.theme.master %}
-
-{% block title %}This forum has been deleted{% endblock %}
-
-{% block header %}This forum has been deleted{% endblock %}
-
-{% block content %}
-<p>The forum you are trying to access no longer exists.</p>
-{% endblock %}