Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I entered a text in "Unflag not allowed text" but when I flag a node, the flag disappears and nothing is displayed.
Comment | File | Size | Author |
---|---|---|---|
#49 | 2886308-49.patch | 1.47 KB | robphillips |
| |||
#32 | 2886308-Unflag-not-allowed-text-31.patch | 8.56 KB | pnagornyak |
#32 | interdiff-2886308-27-31.txt | 2.89 KB | pnagornyak |
#27 | 2886308-Unflag-not-allowed-text-27.patch | 8.23 KB | pnagornyak |
#27 | interdiff-2886308-20-27.txt | 2.43 KB | pnagornyak |
Issue fork flag-2886308
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
Comment #2
joachim CreditAttribution: joachim commentedComment #3
zenimagine CreditAttribution: zenimagine commenteda
Comment #4
zenimagine CreditAttribution: zenimagine commentedDo you have a solution to this problem? thank you
Comment #5
joachim CreditAttribution: joachim commentedIf there was a solution, it would be here...
Comment #6
maaty388 CreditAttribution: maaty388 commentedReview this patch please
Comment #8
zenimagine CreditAttribution: zenimagine commentedI tested and the patch does not work
Comment #9
joachim CreditAttribution: joachim commentedCalls to dsm() should not happen in the flag service, as this is an API, and could be called by things that are not user-controlled, such as cron or REST services.
Comment #10
pnagornyak CreditAttribution: pnagornyak commentedAdded a template for denied message rendering (flag-denied-message.html.twig), by default it will take unflag denied message.
In my opinion, Flag denied message should be added as well.
With this patch you could change message via hook_preprocess_flag_denied_message().
Comment #11
pnagornyak CreditAttribution: pnagornyak commentedComment #12
zenimagine CreditAttribution: zenimagine commentedThanks for the patch. It works, but when "Unflag not allowed text" is empty, the flag is still displayed. See screenshot.
Comment #13
socketwench CreditAttribution: socketwench commentedDoes it really make sense to use the same classes as the flag link here? It seems an additional class at least to identify it as a flag-message is appropriate.
Comment #15
pnagornyak CreditAttribution: pnagornyak commented@zenimagine, i added new patch that fixes it, thank you for testing it :)
@socketwench, You are right, so i changed it to flag-message
Comment #16
pnagornyak CreditAttribution: pnagornyak commentedComment #17
joachim CreditAttribution: joachim commentedThat's not true.
Though do we really need a different template for this?
Comment #18
zenimagine CreditAttribution: zenimagine commentedThanks, but if "Unflag not allowed text" is filled, the style is not applied.
Comment #19
pnagornyak CreditAttribution: pnagornyak commented@joachim, i think yes cause it more flex, but currently we have only Unflag Denied Message, so we should add something like Flag Denied Message, for example: if there is a limitation to flag something (maximum amount of participants on event)
Comment #20
pnagornyak CreditAttribution: pnagornyak commentedAdded new patch that allowed user to add FlagDeniedMessage
Comment #21
pnagornyak CreditAttribution: pnagornyak commentedComment #22
martin107 CreditAttribution: martin107 as a volunteer commentedIMHO this approach is welcome ...I like templates with a single responsibility I think the alternative design would lead to extra control logic in the template... whereas we can use the if statement already in ActionLinkTypeBase::getAsFlagLink()
As by way of review, I can see one minor flaw
flaggable is a unused variable in the template and so could be cut out of :-
The twig file and ActionLinkTypeBase::getAsFlagLink() and flag_theme() --- 'flag_denied_message'
Maybe there is as use case, under consideration that I cannot see?
Comment #23
martin107 CreditAttribution: martin107 as a volunteer commentedI should have mentioned one thing I was thinking about ....
How to we deny access for AJAX action links ?
I think it can be done ... but I think we can leave those discussion to
#2764709: [Regression/Refactor] Restore Ajax link type "flag message" functionality
Comment #24
socketwench CreditAttribution: socketwench commentedThat was intentional. Not for our use, but I can easily imagine cases where the themer would want the flaggable to grab some detail for display with the flag link.
Comment #25
socketwench CreditAttribution: socketwench commentedGetting closer! I see two problems:
Comment #26
martin107 CreditAttribution: martin107 as a volunteer commentedOk - I am happy with that....
Passing an object to a twig template ... that we are denying access to is acceptable.
The use case I can dream up is "a node as a book" ... and the customized message saying "you cannot access/flag the book [of title] xyz."
Comment #27
pnagornyak CreditAttribution: pnagornyak commentedAdded some tests.
Comment #28
pnagornyak CreditAttribution: pnagornyak commentedComment #29
joachim CreditAttribution: joachim commentedI can't tell the difference between these descriptions.
flag, or sometimes unflag too?
Comment #30
pnagornyak CreditAttribution: pnagornyak commented1. Should we change "Gets the flag denied message." to "Gets the flag denied message depending on action"
or remove getDeniedText($action) method and change this?:
to
2. Lets change it to "- message: Access denied message."
Comment #31
pnagornyak CreditAttribution: pnagornyak commentedComment #32
pnagornyak CreditAttribution: pnagornyak commentedUpdated.
Comment #33
pnagornyak CreditAttribution: pnagornyak commentedComment #35
martin107 CreditAttribution: martin107 as a volunteer commentedI think the test failures here are a sign of broken tests
Comment #36
martin107 CreditAttribution: martin107 as a volunteer commentedas pointed out by bedir
https://www.drupal.org/project/flag/issues/2939121#comment-12449244
D8.6.x is going through growing pains .. services have become private and that is causing errors. D8.6.x will fix itself through a critical issue.
In short I am retesting on 8.5.x
Comment #37
pnagornyak CreditAttribution: pnagornyak commentedRelated issue that block this one was closed. And now we got errors with AJAX links test.
Does somebody know what is it? :)
Comment #38
pnagornyak CreditAttribution: pnagornyak commentedComment #39
pnagornyak CreditAttribution: pnagornyak commentedComment #40
pnagornyak CreditAttribution: pnagornyak commentedTests are passed. Please review it as it is a one of release blockers.
Comment #41
tomrogHi, I'm using Flag (8.x-4.0-alpha3) and it's pretty amazing that "unflag_denied_text" property of flag configuration is not used anywhere in rendering process. I'm not sure if my comment is relevant, cause I see all those patches and the version of module in issue is different, but I myself have just adjusted rendering function getAsFlagLink in ActionLinkTypeBase class and that's all there is needed for it. It's basically taken from 7.x version of the module, so wouldn't that fix the problem?
Comment #42
michaelvanh CreditAttribution: michaelvanh commentedI tested the solution in Comment #41 and this worked for me.
Comment #43
vredko CreditAttribution: vredko as a volunteer and commentedI added patch for this there:
https://www.drupal.org/project/flag/issues/3059976#comment-13463196
Comment #44
sashken2 CreditAttribution: sashken2 commentedI have simple solution based on #41
Module Flag 8.x-4.0-beta2. In file /src/ActionLink/ActionLinkTypeBase.php change line 126:
to:
And in flag.html.twig change:
to:
You can see how it works here https://tamadec.ru/pozdravleniya/s-dnem-rozhdeniya
Comment #45
DrupalBubb CreditAttribution: DrupalBubb commentedi think we additionaly need a way to choose between public visible or only visible for users who can see the flag.
Comment #48
robphillips CreditAttribution: robphillips commentedConfirmed #44 works. Converted to MR.
https://git.drupalcode.org/project/flag/-/merge_requests/25/diffs.patch
Comment #49
robphillips CreditAttribution: robphillips commentedPatch updated for 8.x-4.0-beta4 support.
Comment #50
bmx269 CreditAttribution: bmx269 commented#49 works great. Thanks
Comment #51
lluvigne#49 patch works nice! Would be great to have this on a stable release.