mirror of
https://github.com/discourse/discourse.git
synced 2025-06-19 21:01:39 +08:00
FIX: be more lenient when creating a post with a username that is no longer valid
This commit is contained in:
@ -267,11 +267,13 @@ class PostCreator
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_topic_stats
|
def update_topic_stats
|
||||||
# Update attributes on the topic - featured users and last posted.
|
attrs = {
|
||||||
attrs = {last_posted_at: @post.created_at, last_post_user_id: @post.user_id}
|
last_posted_at: @post.created_at,
|
||||||
attrs[:bumped_at] = @post.created_at unless @post.no_bump
|
last_post_user_id: @post.user_id,
|
||||||
attrs[:word_count] = (@topic.word_count || 0) + @post.word_count
|
word_count: (@topic.word_count || 0) + @post.word_count,
|
||||||
|
}
|
||||||
attrs[:excerpt] = @post.excerpt(220, strip_links: true) if new_topic?
|
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)
|
@topic.update_attributes(attrs)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -331,8 +333,7 @@ class PostCreator
|
|||||||
|
|
||||||
@user.user_stat.save!
|
@user.user_stat.save!
|
||||||
|
|
||||||
@user.last_posted_at = @post.created_at
|
@user.update_attributes(last_posted_at: @post.created_at)
|
||||||
@user.save!
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish
|
def publish
|
||||||
|
Reference in New Issue
Block a user