I have fresh dev install. I disabled trusted contacts and also disabled private messages. The site header still shows clickable envelope icon next to name of logged in user. This icon should only appear when private messages are enabled.

Comments

ezra-g’s picture

Status: Active » Postponed (maintainer needs more info)

i 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().

behoppe333’s picture

Thanks 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.

kristiaanvandeneynde’s picture

I have the same issue, utility links show the message icon while private messages are disabled.

ezra-g’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new701 bytes

Here's an untested patch.

ezra-g’s picture

Component: User interface » Email Notifications
ezra-g’s picture

StatusFileSize
new700 bytes

Here's an untested patch that does not contain a parse error.

WebSinPat’s picture

the patch in #6 worked for me.

kristiaanvandeneynde’s picture

StatusFileSize
new3.41 KB

Can confirm patch in #6 works.

Doesn't this seem cleaner though?
It removes a double module_exists() and prevents code from running unnecessarily.

deciphered’s picture

Status: Needs review » Needs work

While 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.

deciphered’s picture

Title: Message icon appears in header even when private messages disabled » Message icon appears in header even when trusted contacts/private messages disabled
Status: Needs work » Needs review
StatusFileSize
new1.17 KB

Didn'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.

kristiaanvandeneynde’s picture

Patch and explanation look good to me.
I also agree with the remark about moving the menu link and permissions.

WebSinPat’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

patch 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.

devin carlson’s picture

Component: Email Notifications » Trusted Contacts and Private Messaging
Status: Reviewed & tested by the community » Needs review
Related issues: +#2090441: commons_notify_commons_utility_links_alter() overwrites the $links array, removing custom links
StatusFileSize
new9.06 KB

As @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.

devin carlson’s picture

Status: Needs review » Fixed

Tested #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

WebSinPat’s picture

Note 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:

 function commons_utility_links_block_view($delta = '') {
   // Gather all of the available utility links.
   $links = module_invoke_all('commons_utility_links');
   drupal_alter('commons_utility_links', $links);
+   $block = array();

WebSinPat’s picture

StatusFileSize
new659 bytes

lil bitty patch per #15, in case it's useful.

devin carlson’s picture

Thanks for the patch!

Committed to Commons 7.x-3.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.