Commits

Marcin Kuzminski  committed 2196aa2

implements #293 gravatar link should be disabled when use_gravatar = false

  • Participants
  • Parent commits de71a4b

Comments (0)

Files changed (4)

File rhodecode/lib/base.py

 from paste.deploy.converters import asbool
 
 from rhodecode import __version__
+from rhodecode.lib import str2bool
 from rhodecode.lib.auth import AuthUser, get_container_username
 from rhodecode.lib.utils import get_repo_slug
 from rhodecode.model import meta
     def __before__(self):
         c.rhodecode_version = __version__
         c.rhodecode_name = config.get('rhodecode_title')
+        c.use_gravatar = str2bool(config.get('use_gravatar'))
         c.ga_code = config.get('rhodecode_ga_code')
         c.repo_name = get_repo_slug(request)
         c.backends = BACKENDS.keys()

File rhodecode/lib/helpers.py

 #==============================================================================
 
 def gravatar_url(email_address, size=30):
-    if not str2bool(config['app_conf'].get('use_gravatar')) or \
-            not email_address or \
-            email_address == 'anonymous@rhodecode.org':
+    if (not str2bool(config['app_conf'].get('use_gravatar')) or
+        not email_address or email_address == 'anonymous@rhodecode.org'):
         return url("/images/user%s.png" % size)
 
     ssl_enabled = 'https' == request.environ.get('wsgi.url_scheme')

File rhodecode/templates/admin/users/user_edit.html

         <div class="field">
            <div class="gravatar_box">
                <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(c.user.email)}"/></div>
-               <p>
-               <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong><br/> 
-               ${_('Using')} ${c.user.email}
-               </p>
+                <p>
+                %if c.use_gravatar:
+                <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong>
+                <br/>${_('Using')} ${c.user.email}
+                %else:
+                <br/>${c.user.email}
+                %endif 
            </div>
         </div>
         <div class="field">

File rhodecode/templates/admin/users/user_edit_my_account.html

                 <div class="gravatar_box">
                     <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(c.user.email)}"/></div>
                     <p>
-                    <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong><br/> 
-                    ${_('Using')} ${c.user.email}
+                    %if c.use_gravatar:
+                    <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong>
+                    <br/>${_('Using')} ${c.user.email}
+                    %else:
+                    <br/>${c.user.email}
+                    %endif 
                     </p>
                 </div>
              </div>