diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -2029,3 +2029,12 @@ def api_call_example(method, args): api_url=route_url('apiv2'), token_url=route_url('my_account_auth_tokens'), data=args_json)) + + +def notification_description(notification, request): + """ + Generate notification human readable description based on notification type + """ + from rhodecode.model.notification import NotificationModel + return NotificationModel().make_description( + notification, translate=request.translate) diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -3708,11 +3708,6 @@ class Notification(Base, BaseModel): return notification - @property - def description(self): - from rhodecode.model.notification import NotificationModel - return NotificationModel().make_description(self) - class UserNotification(Base, BaseModel): __tablename__ = 'user_to_notification' diff --git a/rhodecode/model/notification.py b/rhodecode/model/notification.py --- a/rhodecode/model/notification.py +++ b/rhodecode/model/notification.py @@ -23,13 +23,10 @@ Model for notifications """ - import logging import traceback -from pylons.i18n.translation import _, ungettext from sqlalchemy.sql.expression import false, true -from mako import exceptions import rhodecode from rhodecode.lib import helpers as h @@ -37,7 +34,6 @@ from rhodecode.lib.utils import PartialR from rhodecode.model import BaseModel from rhodecode.model.db import Notification, User, UserNotification from rhodecode.model.meta import Session -from rhodecode.model.settings import SettingsModel from rhodecode.translation import TranslationString log = logging.getLogger(__name__) @@ -238,12 +234,12 @@ class NotificationModel(BaseModel): .filter(UserNotification.notification == notification)\ .filter(UserNotification.user == user).scalar() - def make_description(self, notification, show_age=True, translate=None): + def make_description(self, notification, translate, show_age=True): """ Creates a human readable description based on properties of notification object """ - + _ = translate _map = { notification.TYPE_CHANGESET_COMMENT: [ _('%(user)s commented on commit %(date_or_age)s'), diff --git a/rhodecode/templates/admin/notifications/notifications_data.mako b/rhodecode/templates/admin/notifications/notifications_data.mako --- a/rhodecode/templates/admin/notifications/notifications_data.mako +++ b/rhodecode/templates/admin/notifications/notifications_data.mako @@ -15,7 +15,7 @@