diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-02-06 13:31:46 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-02-06 13:31:46 +0300 |
commit | a04d9ba90c0d1df02f613b7aa01ef598e1ac5b28 (patch) | |
tree | 4a8889592e2290160926ede70aa0cf37bd93519f /app/models/individual_note_discussion.rb | |
parent | c5f1b8346860aa764369a3d156047c9e2c7317ca (diff) |
Add reply to notes to turn into discussions
Diffstat (limited to 'app/models/individual_note_discussion.rb')
-rw-r--r-- | app/models/individual_note_discussion.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/individual_note_discussion.rb b/app/models/individual_note_discussion.rb index 07ee7470ea2..aab0ff93468 100644 --- a/app/models/individual_note_discussion.rb +++ b/app/models/individual_note_discussion.rb @@ -13,6 +13,14 @@ class IndividualNoteDiscussion < Discussion true end + def can_convert_to_discussion? + noteable.supports_replying_to_individual_notes? && Feature.enabled?(:reply_to_individual_notes) + end + + def convert_to_discussion! + first_note.becomes!(Discussion.note_class).to_discussion + end + def reply_attributes super.tap { |attrs| attrs.delete(:discussion_id) } end |