Marcin Kuzminski avatar Marcin Kuzminski committed 989c137

Notification fixes
- added cs ID to notification on changeset comment
- trimmed long commits to 256 chars
- cast to unicode the link re ticket #418

Comments (0)

Files changed (1)

rhodecode/model/comment.py

 from pylons.i18n.translation import _
 from sqlalchemy.util.compat import defaultdict
 
-from rhodecode.lib.utils2 import extract_mentioned_users
+from rhodecode.lib.utils2 import extract_mentioned_users, safe_unicode
 from rhodecode.lib import helpers as h
 from rhodecode.model import BaseModel
 from rhodecode.model.db import ChangesetComment, User, Repository, Notification
         if text:
             repo = Repository.get(repo_id)
             cs = repo.scm_instance.get_changeset(revision)
-            desc = cs.message
+            desc = "%s - %s" % (cs.short_id, h.shorter(cs.message, 256))
             author_email = cs.author_email
             comment = ChangesetComment()
             comment.repo = repo
             line = ''
             if line_no:
                 line = _('on line %s') % line_no
-            subj = h.link_to('Re commit: %(commit_desc)s %(line)s' % \
-                                    {'commit_desc': desc, 'line': line},
-                             h.url('changeset_home', repo_name=repo.repo_name,
-                                   revision=revision,
-                                   anchor='comment-%s' % comment.comment_id,
-                                   qualified=True,
-                                   )
-                             )
+            subj = safe_unicode(
+                h.link_to('Re commit: %(commit_desc)s %(line)s' % \
+                          {'commit_desc': desc, 'line': line},
+                          h.url('changeset_home', repo_name=repo.repo_name,
+                                revision=revision,
+                                anchor='comment-%s' % comment.comment_id,
+                                qualified=True,
+                          )
+                )
+            )
+
             body = text
 
             # get the current participants of this changeset
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.