A platform for community discussion. Free, open, simple.
Fix the build - take 3.
Vinoth Kannan11c4d5eda7d8
diff --git a/app/models/notification.rb b/app/models/notification.rbindex bf52ccdcfd3..fc0e60805b0 100644--- a/app/models/notification.rb+++ b/app/models/notification.rb@@ -147,12 +147,14 @@ class Notification < ActiveRecord::Base# Be wary of calling this frequently. O(n) JSON parsing can suck.def data_hash- return {} if data.blank?+ @data_hash ||= begin+ return {} if data.blank?- parsed = JSON.parse(data)- return {} if parsed.blank?+ parsed = JSON.parse(data)+ return {} if parsed.blank?- parsed.with_indifferent_access+ parsed.with_indifferent_access+ endenddef urldiff --git a/spec/models/post_mover_spec.rb b/spec/models/post_mover_spec.rbindex 42cf45098c0..99ea605ba10 100644--- a/spec/models/post_mover_spec.rb+++ b/spec/models/post_mover_spec.rb@@ -334,12 +334,12 @@ describe PostMover donew_topic = topic.move_posts(user, [p3.id], title: "new testing topic name")- n3.reload+ n3 = Notification.find(n3.id)expect(n3.topic_id).to eq(new_topic.id)expect(n3.post_number).to eq(1)expect(n3.data_hash[:topic_title]).to eq(new_topic.title)- n4.reload+ n4 = Notification.find(n4.id)expect(n4.topic_id).to eq(topic.id)expect(n4.post_number).to eq(4)end@@ -349,7 +349,7 @@ describe PostMover dotopic.move_posts(user, [p1.id], title: "new testing topic name")- n1.reload+ n1 = Notification.find(n1.id)expect(n1.topic_id).to eq(topic.id)expect(n1.data_hash[:topic_title]).to eq(topic.title)expect(n1.post_number).to eq(1)@@ -575,12 +575,12 @@ describe PostMover domoved_to = topic.move_posts(user, [p3.id], destination_topic_id: destination_topic.id)- n3.reload+ n3 = Notification.find(n3.id)expect(n3.topic_id).to eq(moved_to.id)expect(n3.post_number).to eq(2)expect(n3.data_hash[:topic_title]).to eq(moved_to.title)- n4.reload+ n4 = Notification.find(n4.id)expect(n4.topic_id).to eq(topic.id)expect(n4.post_number).to eq(4)end