allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject [06/11] allura git commit: [#5461] option whether or not to subscribe when commenting
Date Thu, 03 Jan 2019 14:57:11 GMT
[#5461] option whether or not to subscribe when commenting


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

Branch: refs/heads/master
Commit: b93083462022317fa61be78efe599cbc882f7954
Parents: dbd45bb
Author: Dave Brondsema <dave@brondsema.net>
Authored: Tue Dec 18 17:02:42 2018 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Wed Dec 19 12:08:05 2018 -0500

----------------------------------------------------------------------
 Allura/allura/lib/widgets/discuss.py                   |  1 +
 Allura/allura/model/discuss.py                         |  5 +++--
 Allura/allura/templates/widgets/edit_post.html         | 13 ++++++++++---
 ForgeDiscussion/forgediscussion/model/forum.py         |  3 +--
 .../templates/discussionforums/thread.html             |  2 +-
 5 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/b9308346/Allura/allura/lib/widgets/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/discuss.py b/Allura/allura/lib/widgets/discuss.py
index 2829a49..e07e73c 100644
--- a/Allura/allura/lib/widgets/discuss.py
+++ b/Allura/allura/lib/widgets/discuss.py
@@ -157,6 +157,7 @@ class EditPost(ff.ForgeForm):
         fields = ew_core.NameList()
         fields.append(ffw.MarkdownEdit(name='text'))
         fields.append(ew.HiddenField(name='forum', if_missing=None))
+        fields.append(ew.Checkbox(name='subscribe', label='Subscribe', if_missing=False))
         if ew_core.widget_context.widget:
             # we are being displayed
             if ew_core.widget_context.render_context.get('show_subject', self.show_subject):

http://git-wip-us.apache.org/repos/asf/allura/blob/b9308346/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 240f2eb..c6cbc58 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -303,10 +303,11 @@ class Thread(Artifact, ActivityObject):
 
     def post(self, text, message_id=None, parent_id=None, notify=True,
              notification_text=None, timestamp=None, ignore_security=False,
-             is_meta=False, **kw):
+             is_meta=False, subscribe=False, **kw):
         if not ignore_security:
             require_access(self, 'post')
-        self.primary().subscribe()
+        if subscribe:
+            self.primary().subscribe()
         if message_id is None:
             message_id = h.gen_message_id()
         parent = parent_id and self.post_class().query.get(_id=parent_id)

http://git-wip-us.apache.org/repos/asf/allura/blob/b9308346/Allura/allura/templates/widgets/edit_post.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/edit_post.html b/Allura/allura/templates/widgets/edit_post.html
index f47fcf8..939ed3d 100644
--- a/Allura/allura/templates/widgets/edit_post.html
+++ b/Allura/allura/templates/widgets/edit_post.html
@@ -28,10 +28,17 @@
     <input type="hidden" class="original_value" value="{{value.text}}">
     <span class="arw"><span></span></span>
     <div style="clear:both"></div>
-    <input type="submit" value="{{submit_text}}" />
-    <a href="#" class="ui-button btn link cancel_edit_post">Cancel</a>&nbsp;
     <a href="#" class="btn link attachment_form_add_button">Add attachments</a>
-    <input type="file" class="text attachment_form_fields" style="display:none" multiple="True"
name="{{att_name}}" {% if att_id %}id="{{att_id}}"{% endif %}/>
+    <input type="file" class="text attachment_form_fields" style="display:none" multiple
name="{{att_name}}" {% if att_id %}id="{{att_id}}"{% endif %}/>
+    <br>
+    <input type="submit" value="{{submit_text}}" />
+    {% if c.user and c.user != c.user.anonymous() %}
+      {# TODO: if not already subscribed (to artifact, or to whole tool) #}
+      <label class="subscribe">
+        <input type="checkbox" checked name="subscribe">Subscribe to this topic
+      </label>
+    {% endif %}
+    <a href="#" class="ui-button btn link cancel_edit_post">Cancel</a>
   {% if widget.antispam %}{% for fld in g.antispam.extra_fields() %}
   {{fld}}{% endfor %}{% endif %}
     {{lib.csrf_token()}}

http://git-wip-us.apache.org/repos/asf/allura/blob/b9308346/ForgeDiscussion/forgediscussion/model/forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/model/forum.py b/ForgeDiscussion/forgediscussion/model/forum.py
index 1796f23..96728ee 100644
--- a/ForgeDiscussion/forgediscussion/model/forum.py
+++ b/ForgeDiscussion/forgediscussion/model/forum.py
@@ -182,8 +182,7 @@ class ForumThread(M.Thread):
         return self
 
     def post(self, subject, text, message_id=None, parent_id=None, **kw):
-        post = super(ForumThread, self).post(
-            text, message_id=message_id, parent_id=parent_id, **kw)
+        post = super(ForumThread, self).post(text, message_id=message_id, parent_id=parent_id,
**kw)
         if not self.first_post_id:
             self.first_post_id = post._id
             self.num_replies = 1

http://git-wip-us.apache.org/repos/asf/allura/blob/b9308346/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html b/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
index 82e2ee7..f6cb8d5 100644
--- a/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
+++ b/ForgeDiscussion/forgediscussion/templates/discussionforums/thread.html
@@ -31,7 +31,7 @@
   {% 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')
}}
-  {{ c.thread_subscription_form.display(value=thread.subscribed(), action='subscribe', style='icon',
thing='thread') }}
+  {{ c.thread_subscription_form.display(value=thread.subscribed(), action='subscribe', style='icon',
thing='topic') }}
 {% endblock %}
 
 {% block edit_box %}


Mime
View raw message