diff --git a/app/models/topic.rb b/app/models/topic.rb index 171c7fd066c..7a370a92616 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -918,8 +918,10 @@ class Topic < ActiveRecord::Base sql = < 0 - end TIME_TO_FIRST_RESPONSE_SQL ||= <<-SQL diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb index b5d15f36e54..3799738ad16 100644 --- a/spec/models/topic_spec.rb +++ b/spec/models/topic_spec.rb @@ -1568,6 +1568,20 @@ describe Topic do expect(Guardian.new(walter).can_see?(group_private_topic)).to be_truthy end end + end + it "Correctly sets #message_archived?" do + topic = Fabricate(:private_message_topic) + user = topic.user + + expect(topic.message_archived?(user)).to eq(false) + + group = Fabricate(:group) + group.add(user) + + TopicAllowedGroup.create!(topic_id: topic.id, group_id: group.id) + GroupArchivedMessage.create!(topic_id: topic.id, group_id: group.id) + + expect(topic.message_archived?(user)).to eq(true) end end