FIX: be more lenient when creating a post with a username that is no longer valid

This commit is contained in:
Régis Hanol 2015-08-12 15:54:51 +02:00
parent abf269c5df
commit ac8e90674b

View File

@ -267,11 +267,13 @@ class PostCreator
end
def update_topic_stats
# Update attributes on the topic - featured users and last posted.
attrs = {last_posted_at: @post.created_at, last_post_user_id: @post.user_id}
attrs[:bumped_at] = @post.created_at unless @post.no_bump
attrs[:word_count] = (@topic.word_count || 0) + @post.word_count
attrs = {
last_posted_at: @post.created_at,
last_post_user_id: @post.user_id,
word_count: (@topic.word_count || 0) + @post.word_count,
}
attrs[:excerpt] = @post.excerpt(220, strip_links: true) if new_topic?
attrs[:bumped_at] = @post.created_at unless @post.no_bump
@topic.update_attributes(attrs)
end
@ -331,8 +333,7 @@ class PostCreator
@user.user_stat.save!
@user.last_posted_at = @post.created_at
@user.save!
@user.update_attributes(last_posted_at: @post.created_at)
end
def publish