Changeset - 2196aa27954b
[Not reviewed]
beta
0 4 0
Marcin Kuzminski - 14 years ago 2011-10-31 22:10:11
marcin@python-works.com
implements #293 gravatar link should be disabled when use_gravatar = false
4 files changed with 17 insertions and 9 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/base.py
Show inline comments
 
@@ -8,12 +8,13 @@ from pylons import config, tmpl_context 
 
from pylons.controllers import WSGIController
 
from pylons.controllers.util import redirect
 
from pylons.templating import render_mako as render
 
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
 
from rhodecode.model.scm import ScmModel
 
from rhodecode import BACKENDS
 
from rhodecode.model.db import Repository
 
@@ -22,12 +23,13 @@ log = logging.getLogger(__name__)
 

	
 
class BaseController(WSGIController):
 

	
 
    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()
 
        self.cut_off_limit = int(config.get('cut_off_limit'))
 

	
 
        self.sa = meta.Session()
rhodecode/lib/helpers.py
Show inline comments
 
@@ -451,15 +451,14 @@ HasRepoPermissionAny, HasRepoPermissionA
 

	
 
#==============================================================================
 
# GRAVATAR URL
 
#==============================================================================
 

	
 
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')
 
    default = 'identicon'
 
    baseurl_nossl = "http://www.gravatar.com/avatar/"
 
    baseurl_ssl = "https://secure.gravatar.com/avatar/"
rhodecode/templates/admin/users/user_edit.html
Show inline comments
 
@@ -26,16 +26,19 @@
 
    <!-- end box / title -->
 
    ${h.form(url('update_user', id=c.user.user_id),method='put')}
 
    <div class="form">
 
        <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">
 
            <div class="label">
 
                <label>${_('API key')}</label> ${c.user.api_key}
 
            </div>
rhodecode/templates/admin/users/user_edit_my_account.html
Show inline comments
 
@@ -26,14 +26,18 @@
 
	    <div class="form">
 
	    
 
             <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}
 
                    %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>   	    
 
	        <div class="field">
 
	            <div class="label">
 
	                <label>${_('API key')}</label> ${c.user.api_key}
0 comments (0 inline, 0 general)