diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-02-06 10:31:46 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-02-06 10:31:46 +0000 |
commit | a04d9ba90c0d1df02f613b7aa01ef598e1ac5b28 (patch) | |
tree | 4a8889592e2290160926ede70aa0cf37bd93519f /app/models/sent_notification.rb | |
parent | c5f1b8346860aa764369a3d156047c9e2c7317ca (diff) | |
download | gitlab-ce-a04d9ba90c0d1df02f613b7aa01ef598e1ac5b28.tar.gz |
Add reply to notes to turn into discussions
Diffstat (limited to 'app/models/sent_notification.rb')
-rw-r--r-- | app/models/sent_notification.rb | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb index e65b3df0fb6..6caab24143b 100644 --- a/app/models/sent_notification.rb +++ b/app/models/sent_notification.rb @@ -48,7 +48,7 @@ class SentNotification < ActiveRecord::Base end def record_note(note, recipient_id, reply_key = self.reply_key, attrs = {}) - attrs[:in_reply_to_discussion_id] = note.discussion_id + attrs[:in_reply_to_discussion_id] = note.discussion_id if note.part_of_discussion? record(note.noteable, recipient_id, reply_key, attrs) end @@ -99,29 +99,12 @@ class SentNotification < ActiveRecord::Base private def reply_params - attrs = { + { noteable_type: self.noteable_type, noteable_id: self.noteable_id, - commit_id: self.commit_id + commit_id: self.commit_id, + in_reply_to_discussion_id: self.in_reply_to_discussion_id } - - if self.in_reply_to_discussion_id.present? - attrs[:in_reply_to_discussion_id] = self.in_reply_to_discussion_id - else - # Remove in GitLab 10.0, when we will not support replying to SentNotifications - # that don't have `in_reply_to_discussion_id` anymore. - attrs.merge!( - type: self.note_type, - - # LegacyDiffNote - line_code: self.line_code, - - # DiffNote - position: self.position.to_json - ) - end - - attrs end def note_valid |