Skip to content
Snippets Groups Projects

add "Uplaod" and "Replace" functionality

Closed gitlab-qa-bot requested to merge github/fork/liyakun/7-5-stable into 7-5-stable

Created by: liyakun

add "replace" functionality, user can replace existing file in current repository. add "upload" functionality, user can upload new file into current repository. replace_01 replace_02 upload_01 upload_02

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Unable to load the diff
  • Created by: houndci-bot

    Line is too long. [92/80]
    Tab detected.

    By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

    By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: houndci-bot

      Inconsistent indentation detected.
      Explicit non-nil checks are usually redundant.
      Tab detected.

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: houndci-bot

      Line is too long. [94/80]
      Tab detected.

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: houndci-bot

      end at 54, 2 is not aligned with if at 16, 5
      Tab detected.

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: houndci-bot

      Line is too long. [88/80]
      Surrounding space missing for operator '='.
      Tab detected.

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: houndci-bot

      Use 2 (not 1) spaces for indentation.
      Explicit non-nil checks are usually redundant.
      Tab detected.

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: houndci-bot

      Use 2 (not 1) spaces for indentation.
      Surrounding space missing for operator '='.
      Tab detected.

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: houndci-bot

      Use 2 (not 1) spaces for indentation.
      Surrounding space missing for operator '='.
      Tab detected.

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: houndci-bot

      Use 2 (not -2) spaces for indentation.
      Tab detected.

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • 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: houndci-bot

      Use 2 (not -1) spaces for indentation.
      Surrounding space missing for operator '='.
      Tab 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 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: dblessing

    @randx before we dive in to review, what do you think of the "replace" and "upload" features?

    By Administrator on 2015-01-31T14:05:47 (imported from GitLab project)

    By Administrator on 2015-01-31T14:05:47 (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)

  • gitlab-qa-bot
  • 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."
    • Created by: houndci-bot

      Align else with if.
      Tab detected.

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • 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)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: houndci-bot

      Inconsistent indentation detected.
      Prefer !expression.nil? over expression != nil.
      Tab detected.

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: houndci-bot

      Unnecessary spacing detected.
      Missing space after #.
      Tab 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)

  • gitlab-qa-bot
  • gitlab-qa-bot
  • gitlab-qa-bot
  • gitlab-qa-bot
  • gitlab-qa-bot
  • gitlab-qa-bot
  • 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.")
    • Created by: houndci-bot

      Line is too long. [131/80]

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • gitlab-qa-bot
  • gitlab-qa-bot
  • 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
    • Created by: houndci-bot

      Line is too long. [96/80]

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • 1 require_relative "base_service"
    2
    3 module Files
    4 class UploadService < BaseService
    5
    • Created by: houndci-bot

      Assignment Branch Condition size for execute is too high. [34.6/15]

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab project)

      By Administrator on 2015-03-31T09:05:01 (imported from GitLab)

  • gitlab-qa-bot
  • gitlab-qa-bot
  • gitlab-qa-bot
  • 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)

  • Please register or sign in to reply
    Loading