allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hei...@apache.org
Subject [1/2] allura git commit: Allow any notification to be active, not just first
Date Tue, 19 Jan 2016 21:58:09 GMT
Repository: allura
Updated Branches:
  refs/heads/master 607bea2bc -> a9ed64eaf


Allow any notification to be active, not just first


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

Branch: refs/heads/master
Commit: 073953a724f3385ee54f5f2137ddd534f771447a
Parents: 375e1d1
Author: Dave Brondsema <dave@brondsema.net>
Authored: Mon Jan 18 17:28:27 2016 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Mon Jan 18 17:34:56 2016 -0500

----------------------------------------------------------------------
 Allura/allura/model/notification.py            | 8 ++++----
 Allura/docs/getting_started/administration.rst | 3 +--
 2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/073953a7/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index b9be654..dfde847 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -707,6 +707,9 @@ class SiteNotification(MappedClass):
     class __mongometa__:
         session = main_orm_session
         name = 'site_notification'
+        indexes = [
+            ('active', '_id'),
+        ]
 
     _id = FieldProperty(S.ObjectId)
     content = FieldProperty(str, if_missing='')
@@ -717,10 +720,7 @@ class SiteNotification(MappedClass):
     page_regex = FieldProperty(str, if_missing=None)
     page_tool_type = FieldProperty(str, if_missing=None)
 
-
     @classmethod
     def current(cls):
-        note = cls.query.find().sort('_id', -1).limit(1).first()
-        if note is None or not note.active:
-            return None
+        note = cls.query.find({'active': True}).sort('_id', -1).limit(1).first()
         return note
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/073953a7/Allura/docs/getting_started/administration.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/getting_started/administration.rst b/Allura/docs/getting_started/administration.rst
index 50a3f0f..9ed2f3d 100644
--- a/Allura/docs/getting_started/administration.rst
+++ b/Allura/docs/getting_started/administration.rst
@@ -328,8 +328,7 @@ which have role 'Developer' or higher in one of their projects.  And if
url of
 the current page is matching regex :code:`(Home|browse_pages)` and app
 tool type is :code:`wiki`.  An "Impressions" value of 0 will show the
 notification indefinitely (until closed).  The notification content can contain
-HTML.  Only the most recent notification will be shown, unless it has
-"Active" unchecked, in which case no notification will be shown.
+HTML.  Only the most recent active notification will be shown.
 "User Role", "Page Regex" and "Page Type" are optional.
 
 .. _delete-projects:


Mime
View raw message