@@ -26,13 +26,13 @@
import logging
import traceback
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
from rhodecode.model.notification import NotificationModel
log = logging.getLogger(__name__)
@@ -64,13 +64,13 @@ class ChangesetCommentsModel(BaseModel):
:param line_no:
"""
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
comment.user_id = user_id
comment.revision = revision
comment.text = text
@@ -80,20 +80,23 @@ class ChangesetCommentsModel(BaseModel):
self.sa.add(comment)
self.sa.flush()
# make notification
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' % \
body = text
# get the current participants of this changeset
recipients = ChangesetComment.get_users(revision=revision)
# add changeset author if it's in rhodecode system
Status change: