allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject [08/11] allura git commit: [#5461] add subscribe option to wiki pages
Date Thu, 03 Jan 2019 14:57:13 GMT
[#5461] add subscribe option to wiki pages


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

Branch: refs/heads/master
Commit: 67fde47f5cf8bcb6b191532ddc44043d4f015adc
Parents: 4a6f8c0
Author: Dave Brondsema <dave@brondsema.net>
Authored: Wed Dec 19 14:05:46 2018 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Thu Dec 20 11:59:01 2018 -0500

----------------------------------------------------------------------
 ForgeWiki/forgewiki/model/wiki.py                 | 4 +++-
 ForgeWiki/forgewiki/templates/wiki/page_edit.html | 8 +++++++-
 ForgeWiki/forgewiki/wiki_main.py                  | 6 ++++--
 3 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/67fde47f/ForgeWiki/forgewiki/model/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/model/wiki.py b/ForgeWiki/forgewiki/model/wiki.py
index bad7a72..e55d464 100644
--- a/ForgeWiki/forgewiki/model/wiki.py
+++ b/ForgeWiki/forgewiki/model/wiki.py
@@ -147,7 +147,9 @@ class Page(VersionedArtifact, ActivityObject):
                     labels=list(self.labels),
                     attachments=self.attachments_for_export() if is_export else self.attachments_for_json())
 
-    def commit(self):
+    def commit(self, subscribe=False):
+        if subscribe:
+            self.subscribe()
         ss = VersionedArtifact.commit(self)
         session(self).flush()
         if self.version > 1:

http://git-wip-us.apache.org/repos/asf/allura/blob/67fde47f/ForgeWiki/forgewiki/templates/wiki/page_edit.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_edit.html b/ForgeWiki/forgewiki/templates/wiki/page_edit.html
index 204b20c..2cb5f50 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_edit.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_edit.html
@@ -67,9 +67,15 @@
 	<div class="grid-14" style="margin-left:0">
 		{{c.label_edit.display(id='labels', name='labels', value=page.labels)}}
   </div>
-  <div class="grid-19">
+  <div class="grid-20">
     <input type="submit" value="Save">
     <input type="reset" value="Cancel">
+    {% if c.user and c.user != c.user.anonymous() %}
+      {# TODO: if not already subscribed to whole tool #}
+      <label class="subscribe">
+        <input type="checkbox" checked name="subscribe">Subscribe to this wiki page
+      </label>
+    {% endif %}
 	</div>
     {{lib.csrf_token()}}
 </form>

http://git-wip-us.apache.org/repos/asf/allura/blob/67fde47f/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 64aaf8b..cb5d893 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -714,7 +714,9 @@ class PageController(BaseController, FeedController):
     def update(self, title=None, text=None,
                labels=None,
                viewable_by=None,
-               new_viewable_by=None, **kw):
+               new_viewable_by=None,
+               subscribe=False,
+               **kw):
         activity_verb = 'created'
         if not title:
             flash('You must provide a title for the page.', 'error')
@@ -745,7 +747,7 @@ class PageController(BaseController, FeedController):
             self.page.labels = labels.split(',')
         else:
             self.page.labels = []
-        self.page.commit()
+        self.page.commit(subscribe=subscribe)
         g.spam_checker.check(title + u'\n' + text, artifact=self.page,
                              user=c.user, content_type='wiki')
         g.director.create_activity(c.user, activity_verb, self.page,


Mime
View raw message