allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [7/9] allura git commit: [#7981] disable per-thread checkboxes form, when subscribed at a higher level
Date Mon, 05 Dec 2016 16:39:40 GMT
[#7981] disable per-thread checkboxes form, when subscribed at a higher level


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

Branch: refs/heads/master
Commit: 5a45aa3f0227e6bfa4db5869412be63fc598edde
Parents: dec2ab0
Author: Dave Brondsema <dave@brondsema.net>
Authored: Fri Nov 18 17:52:18 2016 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Mon Dec 5 11:39:21 2016 -0500

----------------------------------------------------------------------
 Allura/allura/templates/widgets/subscription_form.html |  3 ++-
 Allura/allura/templates/widgets/threads_table.html     | 11 ++++++++++-
 ForgeDiscussion/forgediscussion/controllers/forum.py   |  4 +++-
 3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/5a45aa3f/Allura/allura/templates/widgets/subscription_form.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/subscription_form.html b/Allura/allura/templates/widgets/subscription_form.html
index 7b6ef2f..c03f8d2 100644
--- a/Allura/allura/templates/widgets/subscription_form.html
+++ b/Allura/allura/templates/widgets/subscription_form.html
@@ -25,7 +25,8 @@
   {% endif %}
   <form method="{{method}}" action="{{action}}" {% if enctype %}enctype="{{enctype}}"{%
endif %} class="follow_form">
     {{widget.fields['threads'].display(value=threads)}}
-    {% if threads and not c.user.is_anonymous() %}
+    {% if threads and not c.user.is_anonymous() and
+            not c.subscribed and not c.tool_subscribed %}
     <p>
     <input type="submit" value="Update email subscriptions"/>
     </p>

http://git-wip-us.apache.org/repos/asf/allura/blob/5a45aa3f/Allura/allura/templates/widgets/threads_table.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/threads_table.html b/Allura/allura/templates/widgets/threads_table.html
index 873b537..c4f3d0b 100644
--- a/Allura/allura/templates/widgets/threads_table.html
+++ b/Allura/allura/templates/widgets/threads_table.html
@@ -18,6 +18,9 @@
 -#}
 {% import 'allura:templates/jinja_master/lib.html' as lib with context %}
 
+{% set forum_subscribed = c.subscribed %} {# set in controller #}
+{% set tool_subscribed = c.tool_subscribed %}
+
 <div{{ {'id': div_id}|xmlattr }}>
   <table class="forum-list clear">
     <thead>
@@ -36,7 +39,13 @@
       <tr>
         {% if not c.user.is_anonymous() and allow_subscriptions %}
           <td>
-            <input type="checkbox" name="threads-{{loop.index0}}.subscription" {% if thread.subscribed()
%}checked="checked"{% endif %} />
+            <input type="checkbox" name="threads-{{loop.index0}}.subscription"
+                   {%- if thread.subscribed() or forum_subscribed or tool_subscribed %} checked="checked"
{% endif -%}
+                   {%- if forum_subscribed or tool_subscribed %}
+                        disabled title="You are subscribed to this entire {% if forum_subscribed
%}Forum. Unsubscribe with mail icon in upper right, or on Account - Subscriptions page.
+                            {%- else %}Discussion tool.  Unsubscribe on Account - Subscriptions
page.{% endif %}"
+                   {%- endif -%}
+            />
             <input type="hidden" name="threads-{{loop.index0}}._id" value="{{thread._id}}"/>
           </td>
         {% endif %}

http://git-wip-us.apache.org/repos/asf/allura/blob/5a45aa3f/ForgeDiscussion/forgediscussion/controllers/forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/controllers/forum.py b/ForgeDiscussion/forgediscussion/controllers/forum.py
index 52b3b7c..3b81842 100644
--- a/ForgeDiscussion/forgediscussion/controllers/forum.py
+++ b/ForgeDiscussion/forgediscussion/controllers/forum.py
@@ -106,7 +106,9 @@ class ForumController(DiscussionController):
         if self.discussion.deleted:
             redirect(self.discussion.url() + 'deleted')
         limit, page, start = g.handle_paging(limit, page)
-        c.subscribed = M.Mailbox.subscribed(artifact=self.discussion)
+        if not c.user.is_anonymous():
+            c.subscribed = M.Mailbox.subscribed(artifact=self.discussion)
+            c.tool_subscribed = M.Mailbox.subscribed()
         threads = DM.ForumThread.query.find(dict(discussion_id=self.discussion._id, num_replies={'$gt':
0})) \
                                       .sort([('flags', pymongo.DESCENDING), ('last_post_date',
pymongo.DESCENDING)])
         c.discussion = self.W.discussion


Mime
View raw message