The problem

One reason we didn't ship a "Who's bookmarked this" default view is because we didn't have a way to put a tab on certain nodes only (Namely, nodes to which a flag applies).

The problem continues

Views 2 somewhat solves this by providing a "Node" validator, which validates only nodes of certain types.

But this isn't yet a satisfying solution: the node-types specified for this validator can go out of sync with the node-types specified in the flag settings. Examples:

1. The user edits a default view. He thereby creates a copy of it. He then adds node types in the flag's settings. These new node types aren't included in those of the "Node" validator.

2. A user "clones" a default view we provide, because he thinks it's a good starting point. He changes the flag in the relationship. But he doesn't change the node-types specified for the "Node" validator (either because he forgets or because he don't know too much about Views).

The solution

The patch solves this by defining a "Flaggable node" (and "Flaggable user", and whatever) validator.

I'm attaching a screenshot.

The screenshot shows that hidden here are _three_ related validators:
1. Whether an object is flaggable.
2. Whether an object is flagged.
3. Whether an object is flagged by the current user.

CommentFileSizeAuthor
validator.png54.06 KBmooffie
validator.diff8.78 KBmooffie
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

quicksketch’s picture

This looks great to me Mooffie! We need to update it for the new Views API, but I say whenever you get a chance, put it in. I generally try to avoid personal statements in code comments, such as "I don't think a comment validator will be very useful". Just state it factually "A comment validator is not very useful".

mooffie’s picture

Status: Needs review » Fixed

Committed.
http://drupal.org/cvs?commit=144480

It's good that Views has this new "load on demand" feature. These extra lines of code won't be loaded when not needed.

I generally try to avoid personal statements in code comments, such as "I don't think a comment validator will be very useful". Just state it factually "A comment validator is not very useful".

You're right, that style is especially inappropriate when people are collaborating. I changed that.

That "don't think..." / "am not sure..." style was meant to convey the meaning that the decision discussed was made arbitrarily (not randomly, though).

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

grigori’s picture

please can someone finally tell me how can i display list of users who flagged node, c'on! please
nowhere i can find it!!!!!!

balu....’s picture

Version: 6.x-1.x-dev » 7.x-3.x-dev
Component: Code » Flag core
joachim’s picture

Version: 7.x-3.x-dev » 6.x-1.x-dev