Problem/Motivation

SubscribeMenuLink::getTitle() returns "Upgrade" when the current user has a subscription and "Join" otherwise, but getCacheContexts() declares only user.roles. Subscription ownership is per-user, not per-role-combination: two authenticated users with identical roles (common before any subscription-granted role, i.e. exactly the population deciding whether to join) share a render-cached menu entry, so whichever renders first fixes the label for the other. A subscriber can see "Join", or a non-subscriber "Upgrade".

Steps to reproduce

  1. Two users with the same roles, one subscribed (whose plan grants no role, or before role grant), on a site with render-cached menus.
  2. Load pages as each; both see the label produced for whoever primed the cache.

Proposed resolution

Declare the user cache context, and add the subscription_list cache tag via getCacheTags() so the label updates when subscriptions change (the module already invalidates that tag on subscription insert/update/delete). While in the file, wrap the two titles in $this->t() and have SubscriptionManagerController::subscribeTitle() reuse the same strings, fixing their missing translatability in one place.

Remaining tasks

Patch; extend SubscribeMenuLinkTitleTest to assert contexts/tags.

User interface changes

Correct per-user Join/Upgrade labels; strings become translatable.

API changes

None.

Data model changes

None.

Comments

colan created an issue. See original summary.

colan’s picture