FIX: deleting a topic result not updated on screen
This commit is contained in:
parent
3701a8ada2
commit
6e4ff45e44
|
@ -758,7 +758,6 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
},
|
||||
|
||||
deleteTopic() {
|
||||
this.unsubscribe();
|
||||
this.get('content').destroy(Discourse.User.current());
|
||||
},
|
||||
|
||||
|
|
|
@ -109,8 +109,11 @@ class PostDestroyer
|
|||
# When a user 'deletes' their own post. We just change the text.
|
||||
def mark_for_deletion
|
||||
I18n.with_locale(SiteSetting.default_locale) do
|
||||
|
||||
# don't call revise from within transaction, high risk of deadlock
|
||||
@post.revise(@user, { raw: I18n.t('js.post.deleted_by_author', count: SiteSetting.delete_removed_posts_after) }, force_new_version: true)
|
||||
|
||||
Post.transaction do
|
||||
@post.revise(@user, { raw: I18n.t('js.post.deleted_by_author', count: SiteSetting.delete_removed_posts_after) }, force_new_version: true)
|
||||
@post.update_column(:user_deleted, true)
|
||||
@post.update_flagged_posts_count
|
||||
@post.topic_links.each(&:destroy)
|
||||
|
@ -122,9 +125,11 @@ class PostDestroyer
|
|||
Post.transaction do
|
||||
@post.update_column(:user_deleted, false)
|
||||
@post.skip_unique_check = true
|
||||
@post.revise(@user, { raw: @post.revisions.last.modifications["raw"][0] }, force_new_version: true)
|
||||
@post.update_flagged_posts_count
|
||||
end
|
||||
|
||||
# has internal transactions, if we nest then there are some very high risk deadlocks
|
||||
@post.revise(@user, { raw: @post.revisions.last.modifications["raw"][0] }, force_new_version: true)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in New Issue