Show More
@@ -88,7 +88,6 b' class ChangesetCommentsModel(BaseModel):' | |||||
88 | if revision: |
|
88 | if revision: | |
89 | cs = repo.scm_instance.get_changeset(revision) |
|
89 | cs = repo.scm_instance.get_changeset(revision) | |
90 | desc = "%s - %s" % (cs.short_id, h.shorter(cs.message, 256)) |
|
90 | desc = "%s - %s" % (cs.short_id, h.shorter(cs.message, 256)) | |
91 | author_email = cs.author_email |
|
|||
92 | comment.revision = revision |
|
91 | comment.revision = revision | |
93 | elif pull_request: |
|
92 | elif pull_request: | |
94 | pull_request = self.__get_pull_request(pull_request) |
|
93 | pull_request = self.__get_pull_request(pull_request) | |
@@ -122,7 +121,11 b' class ChangesetCommentsModel(BaseModel):' | |||||
122 | # get the current participants of this changeset |
|
121 | # get the current participants of this changeset | |
123 | recipients = ChangesetComment.get_users(revision=revision) |
|
122 | recipients = ChangesetComment.get_users(revision=revision) | |
124 | # add changeset author if it's in rhodecode system |
|
123 | # add changeset author if it's in rhodecode system | |
125 | recipients += [User.get_by_email(author_email)] |
|
124 | cs_author = User.get_from_cs_author(cs.author) | |
|
125 | if not cs_author: | |||
|
126 | #use repo owner if we cannot extract the author correctly | |||
|
127 | cs_author = repo.user | |||
|
128 | recipients += [cs_author] | |||
126 | email_kwargs = { |
|
129 | email_kwargs = { | |
127 | 'status_change': status_change, |
|
130 | 'status_change': status_change, | |
128 | } |
|
131 | } |
@@ -454,6 +454,26 b' class User(Base, BaseModel):' | |||||
454 |
|
454 | |||
455 | return ret |
|
455 | return ret | |
456 |
|
456 | |||
|
457 | @classmethod | |||
|
458 | def get_from_cs_author(cls, author): | |||
|
459 | """ | |||
|
460 | Tries to get User objects out of commit author string | |||
|
461 | ||||
|
462 | :param author: | |||
|
463 | """ | |||
|
464 | from rhodecode.lib.helpers import email, author_name | |||
|
465 | # Valid email in the attribute passed, see if they're in the system | |||
|
466 | _email = email(author) | |||
|
467 | if _email: | |||
|
468 | user = cls.get_by_email(_email, case_insensitive=True) | |||
|
469 | if user: | |||
|
470 | return user | |||
|
471 | # Maybe we can match by username? | |||
|
472 | _author = author_name(author) | |||
|
473 | user = cls.get_by_username(_author, case_insensitive=True) | |||
|
474 | if user: | |||
|
475 | return user | |||
|
476 | ||||
457 | def update_lastlogin(self): |
|
477 | def update_lastlogin(self): | |
458 | """Update user lastlogin""" |
|
478 | """Update user lastlogin""" | |
459 | self.last_login = datetime.datetime.now() |
|
479 | self.last_login = datetime.datetime.now() |
General Comments 0
You need to be logged in to leave comments.
Login now