Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BE5C0200CFC for ; Thu, 28 Sep 2017 16:57:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BCE111609C2; Thu, 28 Sep 2017 14:57:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1EA711609CD for ; Thu, 28 Sep 2017 16:57:13 +0200 (CEST) Received: (qmail 14525 invoked by uid 500); 28 Sep 2017 14:57:13 -0000 Mailing-List: contact commits-help@allura.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@allura.apache.org Delivered-To: mailing list commits@allura.apache.org Received: (qmail 14502 invoked by uid 99); 28 Sep 2017 14:57:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Sep 2017 14:57:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9C5C7F5BB7; Thu, 28 Sep 2017 14:57:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kentontaylor@apache.org To: commits@allura.apache.org Date: Thu, 28 Sep 2017 14:57:13 -0000 Message-Id: <6522c52201394afcbf5be2f5ec5ed963@git.apache.org> In-Reply-To: <7a0ce43b5f9d4eff9d2d822a8baf2479@git.apache.org> References: <7a0ce43b5f9d4eff9d2d822a8baf2479@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] allura git commit: [#8164] add subscribe icon in Merge Request action bar archived-at: Thu, 28 Sep 2017 14:57:14 -0000 [#8164] add subscribe icon in Merge Request action bar Project: http://git-wip-us.apache.org/repos/asf/allura/repo Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/6785ab93 Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/6785ab93 Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/6785ab93 Branch: refs/heads/master Commit: 6785ab93f7000770b4478b4338db1c6af8b2a6e6 Parents: 48269b6 Author: Dave Brondsema Authored: Tue Sep 26 12:54:02 2017 -0400 Committer: Kenton Taylor Committed: Thu Sep 28 10:44:49 2017 -0400 ---------------------------------------------------------------------- Allura/allura/controllers/repository.py | 29 +++++++++++++++++++- Allura/allura/templates/repo/merge_request.html | 3 ++ 2 files changed, 31 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/allura/blob/6785ab93/Allura/allura/controllers/repository.py ---------------------------------------------------------------------- diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py index 7b4c703..9518f89 100644 --- a/Allura/allura/controllers/repository.py +++ b/Allura/allura/controllers/repository.py @@ -359,6 +359,7 @@ class MergeRequestController(object): page=None, limit=None, page_size=None, count=None, style='linear') mr_dispose_form = SCMMergeRequestDisposeWidget() + subscribe_form = SubscribeForm(thing='merge request') def __init__(self, num): self.req = M.MergeRequest.query.get( @@ -373,9 +374,18 @@ class MergeRequestController(object): c.thread = self.thread_widget c.log_widget = self.log_widget c.mr_dispose_form = self.mr_dispose_form + c.subscribe_form = self.subscribe_form + limit, page = h.paging_sanitizer(limit, page) with self.req.push_downstream_context(): downstream_app = c.app + + tool_subscribed = M.Mailbox.subscribed() + if tool_subscribed: + subscribed = False + else: + subscribed = M.Mailbox.subscribed(artifact=self.req) + result = dict( downstream_app=downstream_app, req=self.req, @@ -384,7 +394,9 @@ class MergeRequestController(object): merge_status=self.req.merge_task_status(), page=page, limit=limit, - count=self.req.discussion_thread.post_count) + count=self.req.discussion_thread.post_count, + subscribed=subscribed, + ) try: result['commits'] = self.req.commits except Exception: @@ -495,6 +507,21 @@ class MergeRequestController(object): """Return result from the cache. Used by js, after task was completed.""" return {'can_merge': self.req.can_merge()} + @expose('json:') + @require_post() + @validate(subscribe_form) + def subscribe(self, subscribe=None, unsubscribe=None, **kw): + if subscribe: + self.req.subscribe() + elif unsubscribe: + self.req.unsubscribe() + return { + 'status': 'ok', + 'subscribed': M.Mailbox.subscribed(artifact=self.req), + 'subscribed_to_tool': M.Mailbox.subscribed(), + 'subscribed_to_entire_name': 'code repository', + } + class RefsController(object): http://git-wip-us.apache.org/repos/asf/allura/blob/6785ab93/Allura/allura/templates/repo/merge_request.html ---------------------------------------------------------------------- diff --git a/Allura/allura/templates/repo/merge_request.html b/Allura/allura/templates/repo/merge_request.html index c5517c1..fd3acdf 100644 --- a/Allura/allura/templates/repo/merge_request.html +++ b/Allura/allura/templates/repo/merge_request.html @@ -27,6 +27,9 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}}) {% endblock %} {% block actions %} + {% if c.user and c.user != c.user.anonymous() %} + {{ c.subscribe_form.display(value=subscribed, action='subscribe', style='icon') }} + {% endif %} {% if h.has_access(req, 'write')() %} {{ g.icons['edit'].render(href='edit', show_title=True) }} {% endif %}