add "Uplaod" and "Replace" functionality
Merge request reports
Activity
Created by: TeatroIO
I've prepared a stage to preview changes. Open stage or view logs.
By Administrator on 2015-01-29T17:07:31 (imported from GitLab project)
By Administrator on 2015-01-29T17:07:31 (imported from GitLab)
6 6 end 7 7 8 8 def update 9 file_path = File.join(@path, File.basename(params[:file_name])) 10 result = Files::CreateService.new(@project, current_user, params, @ref, file_path).execute 11 12 if result[:status] == :success Created by: jvanbaarsen
@dblessing Would it be possible that you take a look at this and help @liyakun on the way?
By Administrator on 2015-01-31T12:20:36 (imported from GitLab project)
By Administrator on 2015-01-31T12:20:36 (imported from GitLab)
Created by: jvanbaarsen
@dblessing Good point!
By Administrator on 2015-02-01T20:57:35 (imported from GitLab project)
By Administrator on 2015-02-01T20:57:35 (imported from GitLab)
Created by: dblessing
@liyakun At the moment I'm not sure I feel the replace feature is necessary. Do you have a specific use-case that requires this? Advanced git operations are best suited to the CLI, in my opinion. The web editor does allow a user to 'edit' and then copy/paste to 'replace' the file contents.
The upload feature could have some use. However, I think it would be best served as a part of the create new file popup as opposed to it's own button. For example, the popup could have a spot to paste text or click to upload a file and commit.
By Administrator on 2015-02-02T17:34:10 (imported from GitLab project)
By Administrator on 2015-02-02T17:34:10 (imported from GitLab)
Created by: liyakun
@dblessing The copy and paste works for text file, the replace feature also works for other format file, like image. Also, it is easier to replace than copying and pasting. Maybe it is not necessary, just a consideration for above cases.
I did not find a good position for the upload feature at first, I think your suggestion is good, you may also ask for other people's opinion.
By Administrator on 2015-02-03T17:53:56 (imported from GitLab project)
By Administrator on 2015-02-03T17:53:56 (imported from GitLab)
Created by: 73
Hi all, I think that strategy was to keep alterations to the original behavior to a minimum to keep alienation of users who rely on the copy/paste feature to a minimum.
Looking at: http://feedback.gitlab.com/forums/176466-general/suggestions/5867835-allow-file-upload-to-repositories-from-the-web-int Which is another suggestion that support this feature, besides: http://feedback.gitlab.com/forums/176466-general/suggestions/6961707-create-a-functionality-for-user-to-upload-files-to
I think a "normal" oder "untechy" user like a general manager, customer oder partner (e.g. designers, psychologists, lawyers ...) thinks in files. The user might not want to open a file to submit changes because it was done with a locally installed application (e.g. Gimp, SPSS, R, Word, Excel,...) to generate the changes in the first place.
While a programmer, that just wants to change a line of source code (while having no git client at hand) might want to see the contents of the file.
I think it might be a good idea to keep them separate because of the way different kinds of files are handled by gitlab now. Further I would like to summarise that both ways have their valid use case (or user story if you want).
I hope this makes any sense to you guys, 73
By Administrator on 2015-02-20T06:45:20 (imported from GitLab project)
By Administrator on 2015-02-20T06:45:20 (imported from GitLab)
50 end 51 params[:content] = params[:file_upload].read 52 params[:file_name] = file_na 53 file_path = File.join(@path, File.basename(params[:file_name])) 54 result = Files::CreateService.new(@project, current_user, params, @ref, file_path).execute 55 end 56 end 57 end 58 59 if flag == 0 60 file_path = File.join(@path, File.basename(params[:file_name])) 61 result = Files::CreateService.new(@project, current_user, params, @ref, file_path).execute 62 end 63 64 if result[:status] == :success 65 flash[:notice] = "Your changes have been successfully commited." 48 return 49 end 50 end 51 params[:content] = params[:file_upload].read 52 params[:file_name] = file_na 53 file_path = File.join(@path, File.basename(params[:file_name])) 54 result = Files::CreateService.new(@project, current_user, params, @ref, file_path).execute 55 end 56 end 57 end 58 59 if flag == 0 60 file_path = File.join(@path, File.basename(params[:file_name])) 61 result = Files::CreateService.new(@project, current_user, params, @ref, file_path).execute 62 end 63 Created by: houndci-bot
Unnecessary spacing detected.
Use 2 (not -2) spaces for indentation.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Tab detected.
Trailing whitespace detected.By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)
By Administrator on 2015-03-31T09:05:01 (imported from GitLab)
Created by: jvanbaarsen
@dblessing Do you know if enything was decided about this PR?
By Administrator on 2015-02-23T09:08:39 (imported from GitLab project)
By Administrator on 2015-02-23T09:08:39 (imported from GitLab)
- app/services/files/upload_service.rb 0 → 100644
21 blob = repository.blob_at_branch(ref, path) 22 23 unless blob 24 return error("You can only edit text files") 25 end 26 27 edit_file_action = Gitlab::Satellite::EditFileAction.new(current_user, project, ref, path) 28 29 created_successfully = edit_file_action.commit!(params[:content], 30 params[:commit_message_replace], 31 params[:encoding]) 32 33 if created_successfully 34 success 35 else 36 error("Your changes could not be committed.") - app/services/files/upload_service.rb 0 → 100644
11 end 12 13 unless allowed 14 return error("You are not allowed to push into this branch") 15 end 16 17 unless repository.branch_names.include?(ref) 18 return error("You can only create files if you are on top of a branch") 19 end 20 21 blob = repository.blob_at_branch(ref, path) 22 23 unless blob 24 return error("You can only edit text files") 25 end 26 - app/services/files/upload_service.rb 0 → 100644
1 require_relative "base_service" 2 3 module Files 4 class UploadService < BaseService 5 Created by: 73
Hi, is there a timeline for this PR yet? I don't want to sound impatient, but this feature would mean a real game changer in terms of collaboration for us and we would really like to have it in the project.
Thanks for all your hard work, 73
By Administrator on 2015-03-23T09:49:50 (imported from GitLab project)
By Administrator on 2015-03-23T09:49:50 (imported from GitLab)
Created by: dblessing
@liyakun Can you please clean up all the hound warnings?
By Administrator on 2015-03-23T15:26:45 (imported from GitLab project)
By Administrator on 2015-03-23T15:26:45 (imported from GitLab)
Created by: liyakun
@dblessing, thank you, I already did the code style correction.
By Administrator on 2015-03-23T16:33:52 (imported from GitLab project)
By Administrator on 2015-03-23T16:33:52 (imported from GitLab)
Created by: dzaporozhets
@liyakun can you please rebase on current master so CI includes more tests and also squash your commits into one. After this please make sure CI is green and ping me so I can review.
By Administrator on 2015-03-25T01:16:39 (imported from GitLab project)
By Administrator on 2015-03-25T01:16:39 (imported from GitLab)