I have set a message "Thank you" for Flagged message with AJAX link type. I set the permission for anonymous user can only flag the node but no permission for unflag.

After anonymous flag the node, it leaves a blank space there, no" Thank you" message showing on the place. please advise, thank you.

Issue fork flag-3295483

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:

Comments

freelylw created an issue. See original summary.

ivnish’s picture

I can confirm this

ivnish’s picture

Version: 8.x-4.x-dev » 5.x-dev

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

deaom’s picture

Status: Active » Needs review

The issue happens as the JS code can't append the flagging message, in this case Thank you, to the flag link as there is none on the page. There is also a console error that shows that. As the permission to unflag is not there, the markup is not generated and therefore the message not appended. Updated the code so the markup is displayed without the unflag link and then removed in the JS. Not sure if the right approach, so needs review.

ivnish’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

@deaom could you write a simple test ?

deaom’s picture

Status: Needs work » Needs review

Added a simple test that check if the anonymous user with only flag permission can see the flag message and not see unflag link. Ready for review.

ivnish’s picture

Issue tags: -Needs tests

  • ivnish committed bc25d062 on 5.x authored by deaom
    fix: #3295483 Flagged message not showing for anonymous user
    
    By:...
ivnish’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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