mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
FEATURE: Report edit conflicts when saving draft. (#6585)
This commit is contained in:

committed by
Régis Hanol

parent
d078808144
commit
34e4d82f1a
@ -10,6 +10,15 @@ class DraftController < ApplicationController
|
||||
|
||||
def update
|
||||
Draft.set(current_user, params[:draft_key], params[:sequence].to_i, params[:data])
|
||||
|
||||
if params[:post_id] && params[:original_text]
|
||||
post = Post.find_by(id: params[:post_id])
|
||||
if post && post.raw != params[:original_text]
|
||||
conflict_user = BasicUserSerializer.new(post.last_editor, root: false)
|
||||
return render json: success_json.merge(conflict_user: conflict_user)
|
||||
end
|
||||
end
|
||||
|
||||
render json: success_json
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user