If the anonymous user doesn't have permissions to create a product review the link returns a 403. It would be best if there was a message inviting the user to log in.

Comments

introfini created an issue. See original summary.

alexandersluiter’s picture

If you swap the '#url' array item out in OverallRatingStarsFormatter.php aroudn line 216 with the following, you won't get 403's anymore and it will forward already-logged-in users to the review page just fine.

Url::fromRoute('user.login', [], ['query' => ['destination' => Url::fromRoute('entity.commerce_product.review_form', ['commerce_product' => $product->id()])->toString()]]),

We have a bunch of custom patches to this module, I can write a patch for just this if you'd like.

agoradesign’s picture

sounds reasonable. Yes, a patch would be great. This module is not in my scope at the moment, but with a ready patch, I can review and commit it, if it's ok.

Although the login link is redirecting already logged in users, it wouldn't hurt to do an additonal check... I'd prefer first create the url to review, as we need this anyway. Then check for anonymous user and within that if create the login url and re-use the first url object in the destination parameter.

  • agoradesign committed 6155024 on 8.x-1.x
    Issue #3075655 by introfini, alexandersluiter, agoradesign: Check if the...
agoradesign’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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