summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-07-11 17:53:38 +0000
committerRémy Coutable <remy@rymai.me>2016-07-11 17:53:38 +0000
commitf5ceb638963f38fb647b29d7a69af5e38509d7a6 (patch)
treec13ee69c2c49e5c663af41a448b15542a9346f45 /app
parentef9ba9050e65f9f5572100989745b1b39f764b3b (diff)
parentea40c08d5f313defade9a939e5d5d841aa3ba902 (diff)
downloadgitlab-ce-f5ceb638963f38fb647b29d7a69af5e38509d7a6.tar.gz
Merge branch 'fix-sent-notification-position' into 'master'
Allow SentNotification#position to be set as string or hash Fixes https://sentry.gitlap.com/gitlab/staginggitlabcom/issues/8491/ See merge request !5189
Diffstat (limited to 'app')
-rw-r--r--app/models/sent_notification.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb
index 016172c6d7e..f4bcb49b34d 100644
--- a/app/models/sent_notification.rb
+++ b/app/models/sent_notification.rb
@@ -72,6 +72,19 @@ class SentNotification < ActiveRecord::Base
end
end
+ def position=(new_position)
+ if new_position.is_a?(String)
+ new_position = JSON.parse(new_position) rescue nil
+ end
+
+ if new_position.is_a?(Hash)
+ new_position = new_position.with_indifferent_access
+ new_position = Gitlab::Diff::Position.new(new_position)
+ end
+
+ super(new_position)
+ end
+
def to_param
self.reply_key
end