Hi,

Once the fivestar type field has been created, hovering over the stars no longer works.

Issue fork fivestar-3170189

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Paulset created an issue. See original summary.

TR’s picture

Category: Bug report » Support request
Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

Please be more explicit. As far as I can tell, hovering over the stars works the same as it did in D7.

Paulset’s picture

In the content creation form (vote when editing), hovering over stars no longer works, so it is not possible to assign a rating.

TR’s picture

Again, this works fine for me. Here's what I did:

  1. Edited the "Basic page" content type at /admin/structure/types.
  2. Added a "Fivestar rating" field.
  3. Chose "Rated while editing" and used the default values for all other settings.
  4. Saved.

Then,

  1. Went to /node/add/page to create a new "Basic page"
  2. Hovered over the stars in the Fivestar field.
  3. I see hover text and the stars are properly highlighted to indicate where I am hovering.
  4. Added title, body, and selected 4/5 stars. Saved.
  5. Went to the front page. My "Basic page" is listed there, and it shows 4/5 stars, and there is no hover text, and I cannot change the star rating. This is as expected because the field setting is "Rated while editing" which means I cannot rate while viewing.
  6. Clicked on the "Edit" tab to edit the page.
  7. I can now see the hover text and I can select a new star rating while editing.

All of this is working properly as far as I can tell. I cannot find an error here, but again you have still not given much information about how to reproduce the error.

Paulset’s picture

I found the problem.

Configure the module as usual, with a field of type fivestar, and "Rating while editing".

Uncheck "Allow users to re-vote on already voted content", check "Set voting target" and configure as usual.

When you try to create an Article with a fivestar type field, it is not possible to vote (the hovering hover stars does not work), without even having entered or not the reference entity that will receive the vote.

When we check "Allow users to re-vote on already voted content", it works.

Paulset’s picture

Category: Support request » Bug report
Paulset’s picture

Status: Postponed (maintainer needs more info) » Active
brandonratz’s picture

Coming over from https://www.drupal.org/project/fivestar/issues/3193203#comment-13998505

I reproduced the same issue as #5. I am unable to vote with "Allow users to re-vote on already voted content." checked. I have not used the "Set Voting Target" setting.

TR’s picture

Title: Star hover does not work » Star hover does not work when Allow users to re-vote on already voted content" is checked
TR’s picture

Title: Star hover does not work when Allow users to re-vote on already voted content" is checked » Star hover does not work when "Allow users to re-vote on already voted content" is checked
TR’s picture

Closed #3228911: Can't vote when revote option is disabled as a duplicate. Reviewers should verify that any patches in this issue also fix that one.

Paulset’s picture

Status: Active » Fixed

With the patch it is now possible to vote, however, it is also possible to vote again even if vote again is unchecked (with voting target).

So I close this issue and therefore create another one.

TR’s picture

Status: Fixed » Active

No patch has been committed, or even posted in this issue. So this can't be called fixed.

wqmeng made their first commit to this issue’s fork.

wqmeng’s picture

Hello
I submitted a commit to the fivestar-3170189, to fix the fivestar field added to the comment type, and then add the comment to the content type, When you dis-select the "Allow users to re-vote on already voted content" option, the fivestar star hover still active when a user who have already submitted a vote in a previous comment.

How to,

1. Add a comment type such as comment_with_fivestar
2. Add a fivestar field such as field_rating to the above comment type.
a) Select: Rated while editing
b) Enable: Set voting target,
c) Target bridge field: entity_id
d) Target fivestar field: field_rating (this field will need to add to content type movie_review below separately)
e) Disable: Allow users to re-vote on already voted content.

3. Add a content type movie_review, add a comment_with_fivestar comment field to this content type. Add a fivestar field named field_rating same as above 'Target fivestar field' to movie_review.
a) Select: Rated while editing
b) Disable: Set voting target
c) Enable comment of movie_review content type.

4. Create a movie_review node: Movie-A-review
On Movie-A-review node, add a new comment and select the stars to vote and then submit the comment.
Result:
Movie-A-review should show the average rating result in the field_rating added to the Node.
The comment should show the rating of the user.
The star hover should be de-activated if a user have already voted.

I added this in the 8.x-1.0-alpha3+9-dev with a few patches on the Drupal Version 10.1.4-dev, think it should work in D8, and D9 also.

If I have something errors, please let me know.

A patch file added also,

Thanks.

TR’s picture

Status: Active » Needs review
TR’s picture

Status: Needs review » Needs work

Patch does not apply.

wqmeng’s picture

The 15# patch is the same as the 18# in git repository, not sure why 15# does not apply.

TR’s picture

Patch in #15 failed to apply because there is no end-of-line character at the end of the file. The MR looks correct. A diff of the two files will show this missing character.

Why do you have to have a special case for comment entities? Doesn't it happen for any entity type if you're voting on the target?

We need a test case for this. The test case should fail without the patch, demonstrating that there is a problem. The test case should pass when the patch is applied, demonstrating that the patch fixes the problem. The test case also prevent us from breaking this again in the future when other changes are made to this code.

wqmeng’s picture

There is no need to limit the entity type to be comment, while I do not know if there is other case that we need to add a fivestar field to another entity type such as Taxonomy that we vote to Taxonomy item when view it and then submit the vote to the parent content node? If there is a case that we can work with, we could remove this entity type check.

I tried to merge the conflict of this patch to 8.x-1.x, as the old patch file can not patch to 8.x-1.0-alpha5. Hope I do correct.

Thanks

wqmeng’s picture

Here is another patch file, which could patch to the fivestar lasted 8.x-1.0-alpha5 correctly.
Thanks.

TR’s picture

Status: Needs work » Needs review

If you set the issue status to "Needs review" the patch will be automatically tested and it signals to people watching this issue that there is a new version of the patch to look at.

Status: Needs review » Needs work

The last submitted patch, 22: fivestar-3170189-vote-in-comment-star-hover-2.diff, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.