Change the way nuked users' posts are handled. Allow null in the user_id column of posts. Show these posts in the posts stream.

This commit is contained in:
Neil Lalonde
2013-09-04 15:42:21 -04:00
parent 1a6170a47c
commit 117fc8db58
16 changed files with 123 additions and 50 deletions
+25
View File
@@ -0,0 +1,25 @@
require 'spec_helper'
describe PostSerializer do
context "a post by a nuked user" do
let!(:post) { Fabricate(:post, user: Fabricate(:user), deleted_at: Time.zone.now) }
before do
post.user_id = nil
post.save!
end
subject { PostSerializer.new(post, scope: Guardian.new(Fabricate(:admin)), root: false).as_json }
it "serializes correctly" do
[:name, :username, :display_username, :avatar_template].each do |attr|
subject[attr].should be_nil
end
[:moderator?, :staff?, :yours, :user_title, :trust_level].each do |attr|
subject[attr].should be_false
end
end
end
end