Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalizes image upload in drag and drop in markdown to all files. #7078

Closed

Conversation

nmcalabroso
Copy link

(w/ @erbunao)

This is our attempt to generalize the drag-and-drop upload in markdown areas. UI is still the same as #7011. Note that only the images have valid preview.

@dosire, this PR doesn't have any blacklisted file types so we need suggestions from you. Thanks!

def upload_image
link_to_image = ::Projects::ImageService.new(repository, params, root_url).execute
def upload_file
link_to_file = ::Projects::FileService.new(repository, params, root_url).execute

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [84/80]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any tips to solve this warning? :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you really want to:

def upload_file
  link_to_file = ::Projects::FileService.
    new(repository, params, root_url).execute
end

or

def upload_file
  ::Projects::FileService.new(repository, params, root_url).execute
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where I can find ::Projects::FileService class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a git error. Sorry :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just do:

link_to_file = ::Projects::FileService.new(repository, params, root_url).
  execute

@dosire
Copy link
Member

dosire commented Jun 5, 2014

Thanks @nmcalabroso !

We would really like this functionality and I hope @jvanbaarsen and @randx can give you feedback on the code and possible security issues.

end
end

protected

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent access modifiers like protected.
Keep a blank line before and after protected.

@erbunao
Copy link
Contributor

erbunao commented Jun 5, 2014

@nmcalabroso squash it to 1 commit if its final :)

def upload_image
link_to_image = ::Projects::ImageService.new(repository, params, root_url).execute
def upload_file
link_to_file = ::Projects::FileService.new(repository, params, root_url).execute

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [84/80]

@nmcalabroso
Copy link
Author

@erbunao, done, but we should also wait for @jvanbaarsen's feedbacks before finalising this PR.

@nmcalabroso
Copy link
Author

@jvanbaarsen, I just saw the failed test by Travis. Will fix the tests immediately.

@@ -13,12 +13,14 @@
context 'for valid gif file' do
before do
gif = fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif')
@link_to_image = upload_image(@project.repository, { 'markdown_img' => gif }, "http://test.example/")
@link_to_image = upload_image(@project.repository, { 'markdown_file' => gif }, "http://test.example/")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [110/80]
Prefer single-quoted strings when you don't need string interpolation or special symbols.

end
end

context "with valid file" do
context "with valid non-image file" do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

def upload_image
link_to_image = ::Projects::ImageService.new(repository, params, root_url).execute
def upload_file
link_to_file = ::Projects::FileService.new(repository, params, root_url).execute

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [84/80]

@dzaporozhets
Copy link
Member

@nmcalabroso Please fix tests and code style and ping me after so I can do a review and merge it if ok

@jvanbaarsen
Copy link
Contributor

This merge request has been closed because a request for more information has not been reacted to for more than 2 weeks. If you respond and conform to the merge request guidelines in our contributing guidelines we will reopen this merge request.

@dosire
Copy link
Member

dosire commented Jul 27, 2014

@nmcalabroso If you want to fix this please let us know and we can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants