You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2014/01/22 15:58:01 UTC

[4/7] git commit: [#7002] Added activitystream.enabled check to profile section check_display

[#7002] Added activitystream.enabled check to profile section check_display

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


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

Branch: refs/heads/master
Commit: fd3bc746a94c5f3bf47cae4b92553dc1c128b7bf
Parents: 9cd0016
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Tue Jan 21 23:05:35 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Jan 22 14:26:21 2014 +0000

----------------------------------------------------------------------
 Allura/allura/ext/user_profile/user_main.py | 10 +++++-----
 ForgeActivity/forgeactivity/main.py         | 11 ++++++++---
 2 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fd3bc746/Allura/allura/ext/user_profile/user_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/user_main.py b/Allura/allura/ext/user_profile/user_main.py
index 788d8a2..31e4bf0 100644
--- a/Allura/allura/ext/user_profile/user_main.py
+++ b/Allura/allura/ext/user_profile/user_main.py
@@ -146,12 +146,12 @@ class UserProfileController(BaseController, FeedController):
         if not user:
             raise exc.HTTPNotFound()
         provider = AuthenticationProvider.get(request)
-        sections = [section(user, c.project) for section in c.app.profile_sections]
+        sections = [section(user, c.project)
+                    for section in c.app.profile_sections]
         return dict(
-                user=user,
-                reg_date=provider.user_registration_date(user),
-                sections=sections,
-            )
+            user=user,
+            reg_date=provider.user_registration_date(user),
+            sections=sections)
 
     def get_feed(self, project, app, user):
         """Return a :class:`allura.controllers.feed.FeedArgs` object describing

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fd3bc746/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 6d50427..a86d00f 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -33,7 +33,6 @@ from allura.lib.security import require_authenticated
 from allura.model.timeline import perm_check
 from allura.lib import helpers as h
 from allura.lib.decorators import require_post
-from allura.model.timeline import perm_check
 from allura.ext.user_profile import ProfileSectionBase
 
 from .widgets.follow import FollowToggle
@@ -101,7 +100,8 @@ class ForgeActivityController(BaseController):
 
         following = g.director.is_connected(c.user, followee)
         timeline = g.director.get_timeline(followee, page=kw.get('page', 0),
-                                           limit=kw.get('limit', 100), actor_only=actor_only,
+                                           limit=kw.get('limit', 100),
+                                           actor_only=actor_only,
                                            filter_func=perm_check(c.user))
         return dict(followee=followee, following=following, timeline=timeline)
 
@@ -212,7 +212,12 @@ class ForgeActivityProfileSection(ProfileSectionBase):
         self.activity_app = self.project.app_instance('activity')
 
     def check_display(self):
-        return self.activity_app is not None
+        app_installed = self.activity_app is not None
+        activity_enabled = config.get('activitystream.enabled', False)
+        activity_enabled = request.cookies.get(
+            'activitystream.enabled', activity_enabled)
+        activity_enabled = asbool(activity_enabled)
+        return app_installed and activity_enabled
 
     def prepare_context(self, context):
         context.update({