allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject allura git commit: [#8187] Allows editing of forum thread subjects
Date Wed, 21 Feb 2018 22:03:28 GMT
Repository: allura
Updated Branches:
  refs/heads/kt/8187 [created] 3f0876ca5


[#8187] Allows editing of forum thread subjects


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/3f0876ca
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/3f0876ca
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/3f0876ca

Branch: refs/heads/kt/8187
Commit: 3f0876ca5457dcf28a6ecf95f9f3ba4eaa73b3e2
Parents: 44d6b5a
Author: Kenton Taylor <ktaylor@slashdotmedia.com>
Authored: Wed Feb 21 16:58:04 2018 -0500
Committer: Kenton Taylor <ktaylor@slashdotmedia.com>
Committed: Wed Feb 21 16:58:04 2018 -0500

----------------------------------------------------------------------
 .../forgediscussion/controllers/forum.py        |  1 +
 .../tests/functional/test_forum.py              | 32 ++++++++++++++++++++
 .../forgediscussion/widgets/forum_widgets.py    |  1 +
 3 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/3f0876ca/ForgeDiscussion/forgediscussion/controllers/forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/controllers/forum.py b/ForgeDiscussion/forgediscussion/controllers/forum.py
index ee00fe2..338764d 100644
--- a/ForgeDiscussion/forgediscussion/controllers/forum.py
+++ b/ForgeDiscussion/forgediscussion/controllers/forum.py
@@ -191,6 +191,7 @@ class ForumThreadController(ThreadController):
             tasks.calc_forum_stats.post(forum.shortname)
             self.thread.set_forum(forum)
         self.thread.flags = args.pop('flags', [])
+        self.thread.subject = args.pop('subject', self.thread.subject)
         redirect(self.thread.url())
 
     @expose('json:')

http://git-wip-us.apache.org/repos/asf/allura/blob/3f0876ca/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
index 3f20911..bf54413 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
@@ -846,6 +846,38 @@ class TestForum(TestController):
             'div', {'class': 'discussion-post'})
         assert_equal(len(posts), 2)
 
+    def test_rename_thread(self):
+        # make the topic
+        r = self.app.get('/discussion/create_topic/')
+        f = r.html.find('form', {'action': '/p/test/discussion/save_new_topic'})
+        params = dict()
+        inputs = f.findAll('input')
+        for field in inputs:
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
+        params[f.find('textarea')['name']] = 'aaa aaa'
+        params[f.find('select')['name']] = 'testforum'
+        params[f.find('input', {'style': 'width: 90%'})['name']] = 'first subject'
+
+        resp = self.app.post(
+            '/discussion/save_new_topic', params=params).follow()
+        url = resp.request.url
+        resp = self.app.get(url)
+
+        assert 'first subject' in resp
+
+        f = resp.html.find('div', {'id':'mod_thread_form'}).find('form')
+        params=dict(
+            flags='',
+            discussion='general',
+            subject='changed subject')
+        resp = self.app.post(str(f.get('action')), params=params).follow()
+        resp = self.app.get(url)
+
+        assert 'first subject' not in resp.html
+        assert 'changed subject' in resp
+
+
     def test_sidebar_menu(self):
         r = self.app.get('/discussion/')
         sidebar = r.html.find('div', {'id': 'sidebar'})

http://git-wip-us.apache.org/repos/asf/allura/blob/3f0876ca/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py b/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py
index fb063d9..0b34a63 100644
--- a/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py
+++ b/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py
@@ -91,6 +91,7 @@ class ModerateThread(CsrfForm):
     submit_text = 'Save Changes'
 
     class fields(ew_core.NameList):
+        subject = ew.InputField(label='Change subject:')
         discussion = _ForumSelector(label='Move to different forum:')
         flags = ew.CheckboxSet(label='Options', options=['Sticky', 'Announcement'])
 


Mime
View raw message