Changeset - 78059b94991e
[Not reviewed]
default
0 1 0
Thomas De Schampheleire - 5 years ago 2020-11-05 22:17:13
thomas.de_schampheleire@nokia.com
model/comment: inline _get_notification_data

This method was only used in one place, from code which was very related.
Inline it to group things together and reduce complexity.
1 file changed with 4 insertions and 24 deletions:
0 comments (0 inline, 0 general)
kallithea/model/comment.py
Show inline comments
 
@@ -54,13 +54,10 @@ def _list_pull_request_commenters(pull_r
 

	
 
class ChangesetCommentsModel(object):
 

	
 
    def _get_notification_data(self, repo, comment, author, comment_text,
 
                               line_no=None, revision=None, pull_request=None,
 
                               status_change=None, closing_pr=False):
 
        """
 
        :returns: tuple (subj,body,recipients,notification_type,email_kwargs)
 
        """
 
        # make notification
 
    def create_notification(self, repo, comment, author, comment_text,
 
                                line_no=None, revision=None, pull_request=None,
 
                                status_change=None, closing_pr=False):
 

	
 
        body = comment_text  # text of the comment
 
        line = ''
 
        if line_no:
 
@@ -160,23 +157,6 @@ class ChangesetCommentsModel(object):
 
                'threading': threading,
 
            }
 

	
 
        return subj, body, recipients, notification_type, email_kwargs
 

	
 
    def create_notification(self, repo, comment, author, comment_text,
 
                                line_no=None, revision=None, pull_request=None,
 
                                status_change=None, closing_pr=False):
 

	
 

	
 
        (subj, body, recipients, notification_type, email_kwargs) = self._get_notification_data(
 
            repo, comment, author,
 
            comment_text=comment_text,
 
            line_no=line_no,
 
            revision=revision,
 
            pull_request=pull_request,
 
            status_change=status_change,
 
            closing_pr=closing_pr,
 
        )
 

	
 
        email_kwargs['is_mention'] = False
 
        # create notification objects, and emails
 
        notification.NotificationModel().create(
0 comments (0 inline, 0 general)