Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Aug 2018 at 08:02 UTC
Updated:
21 Sep 2018 at 05:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
saesa commentedComment #3
avpadernoComment #4
saesa commentedComment #5
avpadernoComment #6
kybermanReview of the 8.x-1.x branch (commit c6aeaa3):
Comment #7
saesa commentedPAReview result is almost clean, only writing of test is recommended: https://pareview.sh/pareview/https-git.drupal.org-project-go_back.git.Nice README.txt file - please fix only useless "/ul" tag and space after dot ("configuration.You").Package inside go_back.info.yml is set to "Custom" - isn't there some better category? If not, I would use "User interface" or "Other" instead.Inside repository, there is branch named "@branch" - probably better to delete as it doesn't contain any commits.File go_back.css contains absolute paths - please fix them to be relative ("../images/back.png")Your hook_theme provides "block__go__back" template - it should be renamed to "block__go_back" (see "system_theme()").Block GoBack.php is having some minor issues:Condition "if ($config[$bundle]['quick_display'] == '1')" is doubled (lines 177 and 178).Also "$urlb = $_SERVER['HTTP_REFERER'];" is doubled (lines 180 and 182).if you eliminate one of the two it does not work anymoreBasically whole code block of lines 185-194 and 198-207 are duplicates without any reason.I've put the reason in comments in the code, if you see another way that works, I'm happy to hear itIt would be good to autoformat (few extra newlines).Add some inline comments into "build()" function.I would also replace comparing like "$var == '1'" by "!empty($var)".It is a checkbox, it has 0 and 1Comment #8
olegel commentedReview of the 8.x-1.x branch (commit 77b610d):
Module passes Drupal and DrupalPractice coding standards (on my local machine).
1. I noticed in GoBack.php on line 186 if statement with comment inside. It looks like a statement with empty body:
Is it necessary there?
2. Also, code on line 244 would throw an exception if entity type doesn't exist or storage handler couldn't be found. Should those exceptions be caught?
This is from doc comments in EntityTypeManagerInterface.php
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
* Thrown if the entity type doesn't exist.
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* Thrown if the storage handler couldn't be loaded.
3. Line 185: I would add check whether $_SERVER['HTTP_REFERER'] exists since you wrote in comments that it could be from another site.
There might be chance HTTP_REFERRER is not set by some domains. (I don't think it breaks code, since it would be just in $_SERVER array).
Thank you for your efforts.
Comment #9
saesa commentedThanks olegel for the review,
Example:
Smart mode in our site return this:
If we come from page /home smart mode return in our goback block /home not return examle.com/home
Comment #10
olegel commentedNo problem, saesa.
As I wrote, for me your code looks fine.
About first notice with empty if block: since you code jumps to else block, what if you change it like that:
It should work in the same way as you current code.
Comment #11
saesa commentedHow do you restructure the code and that everything works? I think it's fine, if you think there's some way you could patch the module page. Thanks Olegel.
Comment #12
olegel commentedSaesa, please check attached patch. As I mentioned, it is not blocker, and in my opinion, module can be pushed to security coverage policy.
Can I myself change issue's status to fixed (and tested)?
Comment #13
saesa commentedThanks for the patch, you can change the status to Reviewed & tested by the community.
Comment #14
olegel commentedComment #15
avpadernoString to translate should use placeholders to include the dynamic part of the string. In this way, translators have more context to translate the string, considering that in some language the translation of Active button in could change basing on the next word/phrase.
Comment #16
saesa commentedThe dynamic part of the text is the string of the content type, if you translate the content type in the drupal configuration it will already be translated, it is not necessary to translate it again.
Comment #17
avpadernoPlaceholders aren't translated.
If you look at Drupal core for similar code, you won't find code that concatenates a translated string to a not translated string. In those cases, a placeholder is used inside the translated string.
Comment #18
saesa commentedYou mean this?
Comment #19
avpadernoYes, I mean that and similar code the module is using. Compare it with the following code took from NodeController.php.
For more information on the placeholder types, see FormattableMarkup::placeholderFormat().
As side note, even concatenating translated string should be avoided.
Comment #20
saesa commentedYou mean this? I use the code that you passed as an example.
Comment #21
avpadernoThe code should be similar to the following one. A checkbox form element doesn't use #options.
Comment #22
saesa commentedI have already fixed the code as you said.
Comment #23
avpadernoComment #24
saesa commentedWhen pass to fixed?
Comment #25
visabhishek commentedThank you for your contribution!
I am going to update your account so you can opt into security advisory coverage now.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank all the dedicated reviewers as well.
Comment #26
visabhishek commentedAdding credits.