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

Add error msg for null file while Adding Commercial for event #1961

Merged
merged 3 commits into from Mar 2, 2018

Conversation

AnkushMalik
Copy link
Member

@AnkushMalik AnkushMalik commented Jan 12, 2018

Null file error message added for uploading empty file in CommercialsController#mass_upload

Closes #1959

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the upstream master branch.
  • The tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works(if appropriate).
  • I have added necessary documentation (if appropriate).

Short description of what this resolves/which issues does this fix?:

@@ -57,7 +57,9 @@ def render_commercial
def mass_upload
errors = Commercial.read_file(params[:file]) if params[:file]

if errors.all? { |_k, v| v.blank? }
if !errors
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there any other conditions that could cause an error here?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes when user clicks on add commercial without selecting any file 'errors' in line 58^ is nil, it redirects him to error page:

So, i thought there should be a error msg with redirecting user back

Copy link
Member Author

Choose a reason for hiding this comment

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

@bear454, is there any problem with this issue or PR? can you please review this :-) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you misunderstood my question - I read your code as treating any error as a result of a bad file upload; have you considered that other conditions may cause errors ?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, my bad, now I understand my mistake thanks :-)

Null file error message added for uploading empty file in CommercialsController#mass_upload

Closes openSUSE#1959
Copy link
Contributor

@bear454 bear454 left a comment

Choose a reason for hiding this comment

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

👍

@bear454 bear454 merged commit 9132103 into openSUSE:master Mar 2, 2018
@AnkushMalik AnkushMalik deleted the develop branch March 3, 2018 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Null file validation required on adding commercials
2 participants