Closed (fixed)
Project:
Modal
Version:
5.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Dec 2022 at 23:52 UTC
Updated:
13 Jul 2024 at 23:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
renatog commentedComment #3
akhil babuI will try to Implement this.
Comment #4
akhil babuI have created a patch. It removes cookies set my modals when we uninstall the module from UI (Extend -> Uninstall). But its not working when module is uninstalled using drush :(
Comment #5
akhil babuUpdating state for reviews and corrections.
Comment #6
paraderojether commentedHi RenatoG,
I'm new to this module, I applied path #4 against the Modal module
5.0.x-dev and with core version 9.3 and it is working properly as expected.
Please see the screenshot attached.
Thank You.
Comment #7
renatog commentedThanks a lot for your fix @akhil-babu and for your great review @paraderojether
We'll move it soon
Comment #8
renatog commentedif (isset($_COOKIE[$cookie_prefix . $modal->id()])) {I think on Drupal we have a specific function to get cookies instead of using PHP superglobal
$_COOKIEright? 🤔Comment #9
jnlar@RenatoG I believe so :^)
\Drupal::request()->cookiesis one way to interact with session cookies. I've included an updated patch and interdiff from #4.Might be overkill, thought it'd remove some repetitiveness.
Should we be creating a test that tests that Modal cookies are removed post installation as well?
Comment #10
renatog commentedGreat job, thanks a lot!
I have 2 suggestions:
1) Instead of verify if different than empty like:
I think we can verify if is empty, and if so, skip with early return, you know. E.g.:
With that we can avoid "long conditionals"
2nd suggestion:
I saw that you defined a helper (that is good) but we already have a Helper inside of src folder. So I only suggest move the code of this new helper to there. Makes sense?
Comment #11
sourabhjainLet me start with the suggestion #10.
Comment #13
sourabhjainResolved the suggestion 1 from #10 comment. Created the PR too.
2nd suggestion is still remaining.
Comment #14
jnlarThanks all, I will take a look at implementing the 2nd suggestion using the PR branch @sourabhjain created
Comment #15
jnlarI've attempted to implement the second suggestion, moving
modal_remove_cookieinto a method in theModalPageHelperServiceservice. Cheers for that suggestion @RenatoG, let us know if that looks OK.Comment #16
sahilgidwani commentedComment #17
sahilgidwani commentedI have checked and reviewed the MR and it is working perfectly for me.
Comment #18
sahilgidwani commentedComment #20
renatog commentedIt's working fine!
Moved to 5.0.x
Thanks everyone for your contribution effort on this
Comment #21
renatog commented