Flag ships with a default bookmark called "bookmark" to kind of show off how it works. Only problem is, this flag doesn't actually show up anywhere until you edit the settings form and check one or more boxes for "Flaggable content". This requirement isn't obvious at all. This seems to be a regression from D6.

Comments

webchick’s picture

Status: Active » Needs review
StatusFileSize
new2.7 KB

Oh, ok. Upon further inspection, this is just because 'story' was renamed to 'article' in D7. Pretty simple patch.

Also, neat. :) I didn't know Flag had its own tests. I bet those are busted, too. :D

mooffie’s picture

this is just because 'story' was renamed to 'article' in D7. Pretty simple patch.

But 'article' is missing if one is upgrading to D7 from D6 (I think).

So instead of having a fixed array of node types, we can do:

$flag_node_types = array_intersect(array('story', 'article', 'forum', 'blog'), array_keys(node_type_get_types()));
if (!$flag_node_types) {
  // 'page' too may not exist, but we want something to show on the admin page:
  $flag_node_types = array('page');
}

(For D6 we'll use the same code but replace "node_type_get_types" with "node_get_types".)

This also prevents a WTF moment when one sees "blog, forum" where these modules aren't installed.

Nate: before I write a patch, are you ok with this approach?

mooffie’s picture

Status: Needs review » Needs work

I didn't know Flag had its own tests. I bet those are busted, too.

We'll deal with the tests in a separate issue: #901136: Fix the existing tests so they pass.

mooffie’s picture

Version: 7.x-2.0-beta3 » 7.x-2.x-dev
Priority: Normal » Critical
Status: Needs work » Needs review

I'm marking this 'critical'.

Nate, are you fine with the fix I suggest in #2 ?

(I know there is/was a discussion about making a flag apply to all node-types, if none is specified, and this idea indeed has its merits, but we need a solution for the nearer future.)

mooffie’s picture

StatusFileSize
new1.31 KB

Nate, are you OK with this patch?

(For D6 we'll call node_get_types() instead of node_type_get_types(), and remove "article" from the $preferred.)

quicksketch’s picture

Status: Needs review » Reviewed & tested by the community

This sounds good to me, but it seems unnecessary to make a separate function for getting the list of types. I assume this is so that D6 and D7 have similar hook_enable() functions? Looks good enough to me in any case.

mooffie’s picture

Status: Reviewed & tested by the community » Fixed

Committed.
http://drupal.org/cvs?commit=448314
http://drupal.org/cvs?commit=448310

but it seems unnecessary to make a separate function for getting the list of types. I assume this is so that D6 and D7 have similar hook_enable() functions?

Sort of. I didn't plan to do this in a separate function from the start, but PHP isn't a compact language and after some thinking I decided it looked less awful in a separate func.

Status: Fixed » Closed (fixed)

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