Problem/Motivation

When making lists of entities in views, and these entities have the vud_field, the voting widget is displayed even if a user is not allowed to vote. The voting permissions are still respected, which leads to dead voting icons and possibly confused users.

Proposed resolution

Do some kind of permissions check and hide the voting widget all together if the user can't vote.

Remaining tasks

Find a solution.
Implement the solution.
Test the solution.

User interface changes

Voting widget will no longer appear in view lists, if the acting user is not allowed to vote.

Comments

itangalo’s picture

Patch attached.

I am a bit hesitant – would some people like to have the widget visible, even if they can't vote? In that case it *might* make sense to have a "view vote up/down" permission. But the most common case is probably that if you can't vote, you don't want to see the voting widget.

itangalo’s picture

Status: Active » Needs review
marvil07’s picture

Status: Needs review » Needs work

When making lists of entities in views, and these entities have the vud_field, the voting widget is displayed even if a user is not allowed to vote.

Yes, that's right. Please notice that the Use Vote Up/Down permission descriptions is Grant users the ability to cast votes, not view.

There is a lot of logic about read only widgets inside the function you modified, so, adding your patch means dropping functionality.

I guess you can achieve this functionality using Field Permissions.

The voting permissions are still respected, which leads to dead voting icons and possibly confused users.

I think I can not reproduce that behavior. Could you please give more details on how to reproduce it.

itangalo’s picture

I think I can not reproduce that behavior. Could you please give more details on how to reproduce it.

I only meant that the actual widget shows – like thumbs up/down – but the user is not able to click the thumbs.

I didn't mean to remove functionality you put efforts into getting to work. What do you think about the approach to add an additional check box in the view field handler, "only show if user has voting permission"?

itangalo’s picture

I just realized that Vote Up/Down dosn't have it's own views handler (which makes perfect sense, since it's implemented as a field). I thought I was going to create a patch for the new approach, but it will take some more time.

If you have ideas, I'd be happy to listen. (I guess introducing a new permission "view Vote Up/Down widget" is out of the question?)

marvil07’s picture

I only meant that the actual widget shows – like thumbs up/down – but the user is not able to click the thumbs.

Great to know is not broken :-)

I didn't mean to remove functionality you put efforts into getting to work. What do you think about the approach to add an additional check box in the view field handler, "only show if user has voting permission"?

I would say it would be a good idea to try to see if Field Permissions is enough. If not, I guess I will be open to a feature like that.

Please notice that one of the good sides of finally have a vud as fields is actually use other modules for extra general field features, like permissions.

itangalo’s picture

Status: Needs work » Closed (works as designed)

I have been thinking that Field Permissions feels like a quite heavy module to enable just to hide a field – it would have to check permissions for every field at every time.

But on second thoughts you are absolutely right. It's much better to rely on the existing solutions – even when they are more generic than you need for a particular case.

marvil07++

itangalo’s picture

Issue summary: View changes

Crossed off two of three tasks.