-
Notifications
You must be signed in to change notification settings - Fork 192
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
Move video url validation to PostEditorService and invalidate containing form if validation fails. #1508
Move video url validation to PostEditorService and invalidate containing form if validation fails. #1508
Conversation
Hey @brymut, It looks like you haven't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement here. Once you've signed reply with Appreciation of efforts, clabot |
[clabot:check] |
This comment has been minimized.
This comment has been minimized.
4c2c99b
to
27cc105
Compare
Hi @Angamanga , I've managed to get a possible solution working and ready for feedback whenever possible. Also, there was some commented out thumbnail code in the post-video directive that I wasn't sure to remove, should I just leave it for now? |
@brymut This looks good and works fine, super-well done 🎉 . You can absolutely delete the commented out code, thank you for noticing. Another thing that would be nice to have, if you have time, is to display an error-label under the field, in case the url does not pass the validation. We have not had that for videos previously, but now we can actually add it. We do this for other fields, you can have a look here https://github.com/ushahidi/platform-client/blob/develop/app/main/posts/modify/post-value-edit.html#L22 for an example how it is done in other places. If you don't have time its totally fine and I'll add it as a new issue :). Before I approve, @rowasc could you do a double-check as well? Since its one of the gnarliest parts of our code and I might have missed something. 🙏 |
27cc105
to
2e2956d
Compare
Thanks for having a look @Angamanga
I've amended my last commit to delete the commented out code.
At the moment, I don't quite have enough time for the remainder of the week, however, if you can track this a new issue could you please tag/ping me and I'll have a try again over the next week. |
Hi again @Angamanga , just about to continue with adding the error-label you mentioned soon. Should I go on working off this PR or will it be tracked in a separate issue? |
@brymut Sorry for late reply! Yes, please go ahead and add it to this pr since we haven't had time for a second review yet. Thank you so much for working on this 🎉 |
@Angamanga could you please take another quick look and consider for merging again? |
Hi @tuxpiper, sorry I’ve taken so long on updating this PR as I agreed to. May I have one more week? |
no problem @brymut , will check back next week. Thank you! |
Got some progress done with this over the weekend will push by end of day |
…ing form if validation fails. Changes: - move video url validation to PostEditService.validateVideoUrl - use PostEditService.validateVideoUrl to validate url in directive and setValidity of containing form when validation conditions fail. - [test] mock validateVideoUrl & bindAllFunctionsToSelf functions (and fix typo) - [test] add PostEditService.validateVideoUrl tests
2e2956d
to
70a89cb
Compare
hi @brymut! is this ready for review? |
hi @tuxpiper , sorry I should have been more explicit in my previous comment. Yes, please review. |
np @brymut 👌 thanks! @Angamanga could you please take a look? |
@Angamanga just bumping this in case it got lost 😅 Thanks! |
@Angamanga hey just bumping this one (I know you're busy, just making sure it doesn't get lost ) . Thanks ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works fine now! Thank you @brymut for your contribution! 🎉
} | ||
} else { | ||
urlError(url); | ||
$scope.$parent.form.$setValidity('videoUrlValidation', false, PostVideoController) | ||
Notify.error('notify.video.incorrect_url', { url: url }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to also use the validity to show an error-message to the user. We do this for other fields, you can have a look here https://github.com/ushahidi/platform-client/blob/develop/app/main/posts/modify/post-value-edit.html#L22 for an example how it is done for other fields.
@rowasc Reviewed and approved 👍 |
@Obadha2 this can be merged and tested in steve as soon as you're ready |
QA'd, passes. 👍 |
This pull request makes the following changes:
Testing checklist:
Quick demo
![demo of working version](https://github.com/brymut/github-gifs/blob/master/ushahidi:platform-client:pull:1508/pull-1508-ushahidi.gif?raw=true)
apologies if too blurry, I can try to resubmit another screenshot on request.
Fixes ushahidi/platform#3904 .
Ping @ushahidi/platfrom