mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
FIX: be more lenient when creating a post with a username that is no longer valid
This commit is contained in:
parent
abf269c5df
commit
ac8e90674b
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user