Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
for example everytime my editor goes in a node that has broken links he see in the message box the report about broken links but the role editor does not have ANY of the given permissions specific for linkchecker module
Link check of http://www. domain .com/testpage failed once (status code: 301).
perhaps a new permission should be set to allow a role to see reports on node edit
Comment | File | Size | Author |
---|---|---|---|
#23 | linkchecker-hide-messages-1886890-23.patch | 11.31 KB | cboyden |
| |||
#22 | linkchecker-hide-messages-1886890-22.patch | 11.31 KB | cboyden |
|
Comments
Comment #1
hass CreditAttribution: hass commentedIf someone has permission to edit a node / field, he see the message on node edit form. What's wrong with this?
Comment #2
GiorgosKI would just like more granular report accessing the checker links
since in my use case the person who corrects the content
does not know enough to actually correct the links
there is the seperate site administrator that would try to resolve the broken links issues
Comment #3
GiorgosKif that is not good enough reason please close issue
Comment #4
cboyden CreditAttribution: cboyden commentedSeveral of my site admins have also asked for this feature. Here's a patch I'm testing on these installations now - it adds a permission to see broken link messages in context, then checks for that permission before setting messages on the node, comment, and block edit forms.
Comment #6
cboyden CreditAttribution: cboyden commentedThe patch is failing because it hides the broken link messages and those tests check for that message text to appear. I will try patching the test to create and load a user with the new permission first.
Comment #7
cboyden CreditAttribution: cboyden commentedThis patch includes a change to the LinkCheckerInterfaceTest->setUp() function that adds the 'see contextual messages' permission for the test user.
Comment #9
cboyden CreditAttribution: cboyden commented#7: linkchecker-hide-messages-1886890-7.patch queued for re-testing.
Comment #10
hass CreditAttribution: hass commentedThis patch looks good to me, but can you add an additional test to verify that the permission grant/revoke are both checked, please? By adding this permission in these late state we remove the message for everyone who has the module installed. We should add an upgrade hook to add this permission to all roles. This should also happen on hook_install.
Comment #11
cboyden CreditAttribution: cboyden commentedI added install and update hooks - they grant the permission to all roles except anonymous. Also added a test, based on the existing interface test, that revokes the permission and checks that the messages are not showing on the edit forms.
Comment #12
cboyden CreditAttribution: cboyden commentedThe new update hook throws an error if the module has been installed but is disabled when it runs.
Comment #13
hass CreditAttribution: hass commentedThe reason should be that you run functions that are located inside user.module.
These are not available when running .install files. You need to load the user module file before using these functions.
e.g.
drupal_load('module', 'user');
Comment #14
bwood CreditAttribution: bwood as a volunteer commentedHere's a re-roll of #11 which works with the latest -dev.
Comment #15
hass CreditAttribution: hass commented#13
Comment #16
kyleheney CreditAttribution: kyleheney commentedAny chance this gets committed to an updated release version?
Thanks
Comment #17
cboyden CreditAttribution: cboyden commentedLoading the user module didn't fix the error in the update hook when the module had been installed and later disabled. I've attached an updated patch that's rerolled against the latest dev and also skips granting the permission if the module has been disabled.
Comment #18
joelpittetThe permission should probably be a bit more specific to linkchecker because it could conflict with contextual, context, or other modules.
There are some nitpicky coding standards on the array ending parenthesis indent that could be cleaned up as well.
Comment #19
cboyden CreditAttribution: cboyden commentedThanks for the review @joelpittet, I've attached an updated patch that changes the permission name to "see linkchecker messages in context" and fixes the array closing indents.
Comment #20
hass CreditAttribution: hass commentedI do not understand this logic... we run a linkchecker update, but linkchecker is disabled? Ok, this is possible, but why not adding the permission to every role?
Why has this test removed?
Comment #21
cboyden CreditAttribution: cboyden commentedIf the module has been installed, but later disabled, its update hooks still run. But because the module is disabled, you get an error when running the previous version of the update hook. See https://www.drupal.org/node/737816#comment-7398132 and the rest of that issue for discussion of the problem. It was reported in 2010 and looks like it hasn't yet been fixed in D7 or D8. A possible solution, instead of skipping the permission grant, would be to bypass the problematic functions and update the permissions directly in the database. But that seems like overkill.
I will take a look at the missing test, it might have gotten messed up in one of the re-rolls.
Comment #22
cboyden CreditAttribution: cboyden commentedUpdated patch fixes the missing test and also some coding standards issues in the updated code (bracket indentation, spaces, class comments).
Comment #23
cboyden CreditAttribution: cboyden commentedPatch re-rolled against latest dev.