##// END OF EJS Templates
implements #293 gravatar link should be disabled when use_gravatar = false
marcink -
r1643:bdb6fbc8 default
parent child Browse files
Show More
@@ -10,6 +10,7 from pylons.controllers.util import redi
10 10 from pylons.templating import render_mako as render
11 11
12 12 from rhodecode import __version__
13 from rhodecode.lib import str2bool
13 14 from rhodecode.lib.auth import AuthUser
14 15 from rhodecode.lib.utils import get_repo_slug
15 16 from rhodecode.model import meta
@@ -24,6 +25,7 class BaseController(WSGIController):
24 25 def __before__(self):
25 26 c.rhodecode_version = __version__
26 27 c.rhodecode_name = config.get('rhodecode_title')
28 c.use_gravatar = str2bool(config.get('use_gravatar'))
27 29 c.ga_code = config.get('rhodecode_ga_code')
28 30 c.repo_name = get_repo_slug(request)
29 31 c.backends = BACKENDS.keys()
@@ -32,8 +34,6 class BaseController(WSGIController):
32 34 self.sa = meta.Session()
33 35 self.scm_model = ScmModel(self.sa)
34 36
35 #c.unread_journal = scm_model.get_unread_journal()
36
37 37 def __call__(self, environ, start_response):
38 38 """Invoke the Controller"""
39 39 # WSGIController.__call__ dispatches to the Controller method
@@ -56,11 +56,13 class BaseController(WSGIController):
56 56
57 57 class BaseRepoController(BaseController):
58 58 """
59 Base class for controllers responsible for loading all needed data
60 for those controllers, loaded items are
59 Base class for controllers responsible for loading all needed data for
60 repository loaded items are
61 61
62 c.rhodecode_repo: instance of scm repository (taken from cache)
63
62 c.rhodecode_repo: instance of scm repository
63 c.rhodecode_db_repo: instance of db
64 c.repository_followers: number of followers
65 c.repository_forks: number of forks
64 66 """
65 67
66 68 def __before__(self):
@@ -76,7 +78,6 class BaseRepoController(BaseController)
76 78
77 79 redirect(url('home'))
78 80
79 c.repository_followers = \
80 self.scm_model.get_followers(c.repo_name)
81 c.repository_followers = self.scm_model.get_followers(c.repo_name)
81 82 c.repository_forks = self.scm_model.get_forks(c.repo_name)
82 83
@@ -454,8 +454,8 HasRepoPermissionAny, HasRepoPermissionA
454 454 #==============================================================================
455 455
456 456 def gravatar_url(email_address, size=30):
457 if not str2bool(config['app_conf'].get('use_gravatar')) or \
458 email_address == 'anonymous@rhodecode.org':
457 if (not str2bool(config['app_conf'].get('use_gravatar')) or
458 not email_address or email_address == 'anonymous@rhodecode.org'):
459 459 return url("/images/user%s.png" % size)
460 460
461 461 ssl_enabled = 'https' == request.environ.get('wsgi.url_scheme')
@@ -30,9 +30,12
30 30 <div class="gravatar_box">
31 31 <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(c.user.email)}"/></div>
32 32 <p>
33 <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong><br/>
34 ${_('Using')} ${c.user.email}
35 </p>
33 %if c.use_gravatar:
34 <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong>
35 <br/>${_('Using')} ${c.user.email}
36 %else:
37 <br/>${c.user.email}
38 %endif
36 39 </div>
37 40 </div>
38 41 <div class="field">
@@ -29,8 +29,12
29 29 <div class="gravatar_box">
30 30 <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(c.user.email)}"/></div>
31 31 <p>
32 <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong><br/>
33 ${_('Using')} ${c.user.email}
32 %if c.use_gravatar:
33 <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong>
34 <br/>${_('Using')} ${c.user.email}
35 %else:
36 <br/>${c.user.email}
37 %endif
34 38 </p>
35 39 </div>
36 40 </div>
General Comments 0
You need to be logged in to leave comments. Login now