Created
May 4, 2018 18:28
-
-
Save lukfugl/eb07bfcedf23d000067afa067e11d07c to your computer and use it in GitHub Desktop.
fix avatar upload for local storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb | |
index 082feccdaf..cfbe800d3a 100644 | |
--- a/app/controllers/files_controller.rb | |
+++ b/app/controllers/files_controller.rb | |
@@ -764,11 +764,13 @@ class FilesController < ApplicationController | |
@attachment.uploaded_data = params[:file] || params[:attachment] && params[:attachment][:uploaded_data] | |
if @attachment.save | |
# for consistency with the s3 upload client flow, we redirect to the success url here to finish up | |
+ includes = Array(params[:success_include]) | |
+ includes << 'avatar' if @attachment.folder == @attachment.user&.profile_pics_folder | |
redirect_to api_v1_files_create_success_url(@attachment, | |
uuid: @attachment.uuid, | |
on_duplicate: params[:on_duplicate], | |
quota_exemption: params[:quota_exemption], | |
- include: params[:success_include]) | |
+ include: includes) | |
else | |
head :bad_request | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment