allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject allura git commit: [#8187] Allows editing of forum thread subjects
Date Tue, 27 Feb 2018 21:02:21 GMT
Repository: allura
Updated Branches:
  refs/heads/master 557b09ac6 -> 14d4fe1c9


[#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/14d4fe1c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/14d4fe1c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/14d4fe1c

Branch: refs/heads/master
Commit: 14d4fe1c9a67f1debe40f5556360779811f03deb
Parents: 557b09a
Author: Kenton Taylor <ktaylor@slashdotmedia.com>
Authored: Wed Feb 21 16:58:04 2018 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Tue Feb 27 16:02:07 2018 -0500

----------------------------------------------------------------------
 .../forgediscussion/controllers/forum.py        |  1 +
 .../templates/discussionforums/thread.html      |  2 +-
 .../tests/functional/test_forum.py              | 32 ++++++++++++++++++++
 .../forgediscussion/widgets/forum_widgets.py    |  1 +
 4 files changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/14d4fe1c/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/14d4fe1c/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html b/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
index d37d044..90a2ff5 100644
--- a/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
+++ b/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
@@ -27,7 +27,7 @@
 
 {% block actions %}
   {% if show_moderate and h.has_access(thread, 'moderate')() %}
-    {{ g.icons['moderate'].render(id='mod_thread_link') }}
+    {{ g.icons['edit'].render(id='mod_thread_link') }}
   {% endif %}
   {# {{ g.icons['tag'].render(title='Label This', extra_css='thread_tag') }}   these labels
aren't used anywhere ... #}
   {{ g.icons['feed'].render(href='feed.rss', title='Follow This', extra_css='thread_feed0')
}}

http://git-wip-us.apache.org/repos/asf/allura/blob/14d4fe1c/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/14d4fe1c/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py b/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py
index fb063d9..7eb0fc5 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:', attrs={'style':'width: 50%'})
         discussion = _ForumSelector(label='Move to different forum:')
         flags = ew.CheckboxSet(label='Options', options=['Sticky', 'Announcement'])
 


Mime
View raw message