diff --git a/rhodecode/controllers/admin/repos.py b/rhodecode/controllers/admin/repos.py --- a/rhodecode/controllers/admin/repos.py +++ b/rhodecode/controllers/admin/repos.py @@ -137,6 +137,9 @@ class ReposController(BaseController): h.flash(_('Repository %s updated succesfully' % repo_name), category='success') changed_name = form_result['repo_name'] + action_logger(self.rhodecode_user, 'admin_updated_repo', + changed_name, '', self.sa) + except formencode.Invalid, errors: c.repo_info = repo_model.get(repo_name) c.users_array = repo_model.get_users_js() diff --git a/rhodecode/controllers/settings.py b/rhodecode/controllers/settings.py --- a/rhodecode/controllers/settings.py +++ b/rhodecode/controllers/settings.py @@ -82,6 +82,8 @@ class SettingsController(BaseController) h.flash(_('Repository %s updated successfully' % repo_name), category='success') changed_name = form_result['repo_name'] + action_logger(self.rhodecode_user, 'user_updated_repo', + changed_name, '', self.sa) except formencode.Invalid, errors: c.repo_info = repo_model.get(repo_name) c.users_array = repo_model.get_users_js() diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -328,7 +328,7 @@ from mercurial.templatefilters import pe def _age(curdate): """turns a datetime into an age string.""" - + if not curdate: return '' @@ -357,6 +357,50 @@ email_or_none = lambda x: util.email(x) person = lambda x: _person(x) short_id = lambda x: x[:12] + +def action_parser(user_log): + """ + This helper will map the specified string action into translated + fancy names with icons and links + + @param action: + """ + action = user_log.action + action_params = None + cs_links = '' + + x = action.split(':') + + if len(x) > 1: + action, action_params = x + + if action == 'push': + revs_limit = 5 + revs = action_params.split(',') + cs_links = " " + ', '.join ([link(rev, + url('changeset_home', + repo_name=user_log.repository.repo_name, + revision=rev)) for rev in revs[:revs_limit] ]) + if len(revs) > revs_limit: + html_tmpl = ' %s ' + cs_links += html_tmpl % (', '.join(r for r in revs[revs_limit:]), + _('and %s more revisions') % (len(revs) - revs_limit)) + + map = {'user_deleted_repo':_('User deleted repository'), + 'user_created_repo':_('User created repository'), + 'user_forked_repo':_('User forked repository'), + 'user_updated_repo':_('User updated repository'), + 'admin_deleted_repo':_('Admin delete repository'), + 'admin_created_repo':_('Admin created repository'), + 'admin_forked_repo':_('Admin forked repository'), + 'admin_updated_repo':_('Admin updated repository'), + 'push':_('Pushed') + literal(cs_links), + 'pull':_('Pulled'), } + + print action, action_params + return map.get(action, action) + + #============================================================================== # PERMS #============================================================================== diff --git a/rhodecode/templates/admin/admin_log.html b/rhodecode/templates/admin/admin_log.html --- a/rhodecode/templates/admin/admin_log.html +++ b/rhodecode/templates/admin/admin_log.html @@ -3,8 +3,8 @@
${_('Username')} | +${_('Action')} | ${_('Repository')} | -${_('Action')} | ${_('Date')} | ${_('From IP')} |
---|---|---|---|---|---|
${h.link_to(l.user.username,h.url('edit_user', id=l.user.user_id))} | +${h.action_parser(l)} | %if l.repository: ${h.link_to(l.repository.repo_name,h.url('summary_home',repo_name=l.repository.repo_name))} @@ -19,14 +20,7 @@ ${l.repository_name} %endif | -- % if l.action == 'push' and l.revision: - ${h.link_to('%s - %s' % (l.action,l.revision), - h.url('changeset_home',repo_name=l.repository.repo_name,revision=l.revision))} - %else: - ${l.action} - %endif - | +${l.action_date} | ${l.user_ip} |