Show More
@@ -2029,3 +2029,12 b' def api_call_example(method, args):' | |||||
2029 | api_url=route_url('apiv2'), |
|
2029 | api_url=route_url('apiv2'), | |
2030 | token_url=route_url('my_account_auth_tokens'), |
|
2030 | token_url=route_url('my_account_auth_tokens'), | |
2031 | data=args_json)) |
|
2031 | data=args_json)) | |
|
2032 | ||||
|
2033 | ||||
|
2034 | def notification_description(notification, request): | |||
|
2035 | """ | |||
|
2036 | Generate notification human readable description based on notification type | |||
|
2037 | """ | |||
|
2038 | from rhodecode.model.notification import NotificationModel | |||
|
2039 | return NotificationModel().make_description( | |||
|
2040 | notification, translate=request.translate) |
@@ -3708,11 +3708,6 b' class Notification(Base, BaseModel):' | |||||
3708 |
|
3708 | |||
3709 | return notification |
|
3709 | return notification | |
3710 |
|
3710 | |||
3711 | @property |
|
|||
3712 | def description(self): |
|
|||
3713 | from rhodecode.model.notification import NotificationModel |
|
|||
3714 | return NotificationModel().make_description(self) |
|
|||
3715 |
|
||||
3716 |
|
3711 | |||
3717 | class UserNotification(Base, BaseModel): |
|
3712 | class UserNotification(Base, BaseModel): | |
3718 | __tablename__ = 'user_to_notification' |
|
3713 | __tablename__ = 'user_to_notification' |
@@ -23,13 +23,10 b'' | |||||
23 | Model for notifications |
|
23 | Model for notifications | |
24 | """ |
|
24 | """ | |
25 |
|
25 | |||
26 |
|
||||
27 | import logging |
|
26 | import logging | |
28 | import traceback |
|
27 | import traceback | |
29 |
|
28 | |||
30 | from pylons.i18n.translation import _, ungettext |
|
|||
31 | from sqlalchemy.sql.expression import false, true |
|
29 | from sqlalchemy.sql.expression import false, true | |
32 | from mako import exceptions |
|
|||
33 |
|
30 | |||
34 | import rhodecode |
|
31 | import rhodecode | |
35 | from rhodecode.lib import helpers as h |
|
32 | from rhodecode.lib import helpers as h | |
@@ -37,7 +34,6 b' from rhodecode.lib.utils import PartialR' | |||||
37 | from rhodecode.model import BaseModel |
|
34 | from rhodecode.model import BaseModel | |
38 | from rhodecode.model.db import Notification, User, UserNotification |
|
35 | from rhodecode.model.db import Notification, User, UserNotification | |
39 | from rhodecode.model.meta import Session |
|
36 | from rhodecode.model.meta import Session | |
40 | from rhodecode.model.settings import SettingsModel |
|
|||
41 | from rhodecode.translation import TranslationString |
|
37 | from rhodecode.translation import TranslationString | |
42 |
|
38 | |||
43 | log = logging.getLogger(__name__) |
|
39 | log = logging.getLogger(__name__) | |
@@ -238,12 +234,12 b' class NotificationModel(BaseModel):' | |||||
238 | .filter(UserNotification.notification == notification)\ |
|
234 | .filter(UserNotification.notification == notification)\ | |
239 | .filter(UserNotification.user == user).scalar() |
|
235 | .filter(UserNotification.user == user).scalar() | |
240 |
|
236 | |||
241 |
def make_description(self, notification, show_age=True |
|
237 | def make_description(self, notification, translate, show_age=True): | |
242 | """ |
|
238 | """ | |
243 | Creates a human readable description based on properties |
|
239 | Creates a human readable description based on properties | |
244 | of notification object |
|
240 | of notification object | |
245 | """ |
|
241 | """ | |
246 |
|
242 | _ = translate | ||
247 | _map = { |
|
243 | _map = { | |
248 | notification.TYPE_CHANGESET_COMMENT: [ |
|
244 | notification.TYPE_CHANGESET_COMMENT: [ | |
249 | _('%(user)s commented on commit %(date_or_age)s'), |
|
245 | _('%(user)s commented on commit %(date_or_age)s'), |
@@ -15,7 +15,7 b'' | |||||
15 | <div class="desc ${'unread' if not notification.read else '' }"> |
|
15 | <div class="desc ${'unread' if not notification.read else '' }"> | |
16 | <a href="${h.route_path('notifications_show', notification_id=notification.notification.notification_id)}"> |
|
16 | <a href="${h.route_path('notifications_show', notification_id=notification.notification.notification_id)}"> | |
17 | ${base.gravatar(notification.notification.created_by_user.email, 16)} |
|
17 | ${base.gravatar(notification.notification.created_by_user.email, 16)} | |
18 |
${notification.notification |
|
18 | ${h.notification_description(notification.notification, request)} | |
19 | </a> |
|
19 | </a> | |
20 | </div> |
|
20 | </div> | |
21 | <div class="delete-notifications"> |
|
21 | <div class="delete-notifications"> |
@@ -29,7 +29,7 b'' | |||||
29 | <div class="notification-header"> |
|
29 | <div class="notification-header"> | |
30 | ${self.gravatar(c.notification.created_by_user.email, 30)} |
|
30 | ${self.gravatar(c.notification.created_by_user.email, 30)} | |
31 | <div class="desc"> |
|
31 | <div class="desc"> | |
32 |
${c.notification |
|
32 | ${h.notification_description(c.notification, request)} | |
33 | </div> |
|
33 | </div> | |
34 | <div class="delete-notifications"> |
|
34 | <div class="delete-notifications"> | |
35 | <span class="delete-notification tooltip" title="${_('Delete')}" onclick="deleteNotification(${c.notification.notification_id}, [function(){window.location=pyroutes.url('notifications_show_all')}])" class="delete-notification action"><i class="icon-delete" ></i></span> |
|
35 | <span class="delete-notification tooltip" title="${_('Delete')}" onclick="deleteNotification(${c.notification.notification_id}, [function(){window.location=pyroutes.url('notifications_show_all')}])" class="delete-notification action"><i class="icon-delete" ></i></span> |
General Comments 0
You need to be logged in to leave comments.
Login now