changeset 8754:78059b94991e

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.
author Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
date Thu, 05 Nov 2020 22:17:13 +0100
parents cdcebb7c2900
children d952e08eeb03
files kallithea/model/comment.py
diffstat 1 files changed, 4 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/model/comment.py	Thu Nov 05 22:04:05 2020 +0100
+++ b/kallithea/model/comment.py	Thu Nov 05 22:17:13 2020 +0100
@@ -54,13 +54,10 @@
 
 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 @@
                 '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(