allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shalithasura...@apache.org
Subject [allura] branch ss/8323 updated: [#8323] Add notification task call support for wiki artifact
Date Mon, 12 Aug 2019 17:23:24 GMT
This is an automated email from the ASF dual-hosted git repository.

shalithasuranga pushed a commit to branch ss/8323
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/ss/8323 by this push:
     new fbb4540  [#8323] Add notification task call support for wiki artifact
fbb4540 is described below

commit fbb4540c5d809f62093f21909922cc5c39a2d17d
Author: Shalitha Suranga <shalithasuranga@gmail.com>
AuthorDate: Mon Aug 12 22:42:09 2019 +0530

    [#8323] Add notification task call support for wiki artifact
---
 ForgeWiki/forgewiki/wiki_main.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index c7406d2..0032ea2 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -39,6 +39,7 @@ from allura.lib.search import search_app
 from allura.lib.decorators import require_post, memorable_forget
 from allura.lib.security import require_access, has_access
 from allura.lib.utils import is_ajax, JSONForExport
+from allura.tasks import notification_tasks
 from allura.lib import exceptions as forge_exc
 from allura.controllers import AppDiscussionController, BaseController, AppDiscussionRestController
 from allura.controllers import DispatchIndex
@@ -745,6 +746,7 @@ class PageController(BaseController, FeedController):
                         app_config_id=c.app.config._id).root = title
                 self.page.title = title
                 activity_verb = 'renamed'
+        old_text = self.page.text
         self.page.text = text
         if labels:
             self.page.labels = labels.split(',')
@@ -753,6 +755,10 @@ class PageController(BaseController, FeedController):
         self.page.commit(subscribe=subscribe)
         g.spam_checker.check(title + u'\n' + text, artifact=self.page,
                              user=c.user, content_type='wiki')
+        if activity_verb == 'created':
+            notification_tasks.send_usermentions_notification(self.page, text)
+        elif activity_verb == 'modified':
+            notification_tasks.send_usermentions_notification(self.page, text, old_text)
         g.director.create_activity(c.user, activity_verb, self.page,
                                    related_nodes=[c.project], tags=['wiki'])
         if new_viewable_by:


Mime
View raw message