Closed (fixed)
Project:
Drupal Commons
Version:
7.x-3.x-dev
Component:
Trusted Contacts and Private Messaging
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Jul 2013 at 16:32 UTC
Updated:
5 Feb 2014 at 17:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ezra-g commentedi suspect this is related to #1984068: Utility Links block is aggressively cached, displays wrong username., which should be resolved. Can you confirm the "cache" value for the {block} table for the utility links block? Can you also confirm that you have no pending database updates for your site? Caching should be disabled for the utility links block with commons_utility_links_update_7301().
Comment #2
behoppe333 commentedThanks ezra-g.
From phpMyAdmin I see "block" table with "commons_utility_links" record. Value of "cache" field in that record is "-1" (which appears to mean "do not cache")
How do I check pending database updates? I found an API page about that, but it is beyond my technical expertise.
Comment #3
kristiaanvandeneyndeI have the same issue, utility links show the message icon while private messages are disabled.
Comment #4
ezra-g commentedHere's an untested patch.
Comment #5
ezra-g commentedComment #6
ezra-g commentedHere's an untested patch that does not contain a parse error.
Comment #7
WebSinPat commentedthe patch in #6 worked for me.
Comment #8
kristiaanvandeneyndeCan confirm patch in #6 works.
Doesn't this seem cleaner though?
It removes a double module_exists() and prevents code from running unnecessarily.
Comment #9
deciphered commentedWhile mine isn't exactly the same issues, it's highly related; If 'commons_trusted_contacts' is disabled, but Private messages isn't, the icon stays, but the link breaks.
Neither of the patches deal with this issue, and given that the menu path is defined by the 'commons_trusted_contacts' module I think that it is somewhat more important.
Re-roll of patch coming soon.
Comment #10
deciphered commentedDidn't re-roll one of the existing patches, and I don't think either of them where necessarily taking the correct approach.
New patch checks early on if the 'commons_trusted_contacts' module doesn't exist (is disabled) and if so terminates (returns) preventing any of the following logic from running.
The think here is as such:
- If 'commons_trusted_contacts' is disabled, then even if privatemsg is still enabled, as the links are defined by 'commons_trusted_contacts' the link will be broken anyway, so no need to check on privatemsg,
- If 'commons_trusted_contacts' is enabled, then privatemsg is also enabled, therefore no need to check if privatemsg is enabled.
Another potential improvement here would be in the case a dev wants to disable 'commons_trusted_contacts' but keep privatemsg enabled without the trusted contacts functionality, the menu link and permissions should potentially change, but I'm not going down that track in this patch myself for the moment.
Comment #11
kristiaanvandeneyndePatch and explanation look good to me.
I also agree with the remark about moving the menu link and permissions.
Comment #12
WebSinPat commentedpatch in #10 works for me on commons 3.6
and I agree that the logic in the original code and earlier patches didnt seem quite right.
So that's 3 upvotes on this patch and approach so gonna try marking RTBC and see if we can get it committed.
Comment #13
devin carlson commentedAs @Deciphered mentioned in #10, the real dependency is commons_trusted_contacts which defines the paths and requires privatemsg.
While simplifying the code, I've also incorporated a weight property to fix #2090441: commons_notify_commons_utility_links_alter() overwrites the $links array, removing custom links and to allow us to switch from an alter to an info hook.
Comment #14
devin carlson commentedTested #13 with an existing Commons install and confirmed that the utility links were unchanged apart from the message icon properly disappearing when the commons_trusted_contacts module was disabled.
As mentioned in #10, users who want to display an icon when privatemsg is enabled but commons_trusted_contacts is disabled must implement
hook_commons_utility_links()themselves as the paths are different.Committed #13 to Commons 7.x-3.x.
http://drupalcode.org/project/commons.git/commit/c2b0b5e
Comment #15
WebSinPat commentedNote for anyone on 3.8/the release path and not on -dev path, you first have to apply the patch in #2008322: Document commons_utility_links APIs before you can apply #13.
A minor note on this patch/commit: I ran into a php error when my $links array was empty --> caused $block being undefined, which can be fixed by the following in commons_utility_links.module:
Comment #16
WebSinPat commentedlil bitty patch per #15, in case it's useful.
Comment #17
devin carlson commentedThanks for the patch!
Committed to Commons 7.x-3.x.