FIX: when uploading same file was pasted into multiple composers
This commit is contained in:
parent
f3a5a6f8dc
commit
bb3fb37650
|
@ -153,7 +153,7 @@ GEM
|
|||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
memory_profiler (0.9.0)
|
||||
message_bus (1.0.11)
|
||||
message_bus (1.0.12)
|
||||
rack (>= 1.1.3)
|
||||
redis
|
||||
metaclass (0.0.4)
|
||||
|
|
|
@ -22,7 +22,7 @@ export default Em.Mixin.create({
|
|||
});
|
||||
|
||||
$upload.fileupload({
|
||||
url: uploadUrl + ".json?authenticity_token=" + encodeURIComponent(csrf),
|
||||
url: uploadUrl + ".json?client_id=" + this.messageBus.clientId + "&authenticity_token=" + encodeURIComponent(csrf),
|
||||
dataType: "json",
|
||||
dropZone: $upload,
|
||||
pasteZone: $upload
|
||||
|
|
|
@ -332,7 +332,7 @@ const ComposerView = Discourse.View.extend(Ember.Evented, {
|
|||
});
|
||||
|
||||
$uploadTarget.fileupload({
|
||||
url: Discourse.getURL("/uploads.json?authenticity_token=" + encodeURIComponent(csrf)),
|
||||
url: Discourse.getURL("/uploads.json?client_id=" + this.messageBus.clientId + "&authenticity_token=" + encodeURIComponent(csrf)),
|
||||
dataType: "json",
|
||||
pasteZone: $uploadTarget,
|
||||
});
|
||||
|
|
|
@ -6,6 +6,7 @@ class UploadsController < ApplicationController
|
|||
type = params.require(:type)
|
||||
file = params[:file] || params[:files].first
|
||||
url = params[:url]
|
||||
client_id = params[:client_id]
|
||||
|
||||
Scheduler::Defer.later("Create Upload") do
|
||||
begin
|
||||
|
@ -38,7 +39,7 @@ class UploadsController < ApplicationController
|
|||
|
||||
data = upload.errors.empty? ? upload : { errors: upload.errors.values.flatten }
|
||||
|
||||
MessageBus.publish("/uploads/#{type}", data.as_json, user_ids: [current_user.id])
|
||||
MessageBus.publish("/uploads/#{type}", data.as_json, client_ids: [client_id])
|
||||
ensure
|
||||
tempfile.try(:close!) rescue nil
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue