Attached patch changes og_subscribe_link() to return a string "Awaiting approval" for users that have already requested membership to the given group. It also changes the subscription form submit button to "Request membership" for moderated groups, instead of simply "Join".

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Grayside’s picture

FileSize
3 KB

Same basic approach, but this one relies on og_get_subscriptions() to actually control the database interaction. The goal with this approach is to domino the $reset as thoroughly as possible. Downside: slightly more intensive the first time you run og_is_group_member.

Grayside’s picture

FileSize
3.01 KB

That last one was a bit screwy. This replaces #1, and is competing with #0.

amitaibu’s picture

@Grayside,
Thanks, can you add a simpletest to check the new API function?

Grayside’s picture

@Amitaibu
I will try to get to writing a test this week.

Grayside’s picture

I've tweaked the og.subscribe.test on account of some of the changes, but I am trying to determine the best way to test og_is_pending_member(). It strikes me that testing og_subscribe_link() thoroughly would include testing that. Not sure what the best approach would be to get og_subscribe_link rendered on the screen. Any suggestions?

amitaibu’s picture

og_is_pending_member() is an API function, so the test doesn't need to run through the UI. It would be nice, though, to also have a test to the UI part.

Grayside’s picture

FileSize
7.09 KB

So not a SimpleTest? Or am I confused? Not really sure how to even test the UI, unless I turn on the PHP module and create a node special for it.

Attached patch modifies an existing test to play nice with the changes. It does not properly address og_is_pending_member(), but I wanted to get the modification into the issue.

hefox’s picture

Status: Needs review » Needs work

Grayside will be updating the patch to not re-use $gid inside og_is_pending_member causing it to return incorrectly first call sometimes.

Grayside’s picture

Status: Needs work » Needs review
FileSize
2.66 KB

Reroll and tweak of #2.

Grayside’s picture

Status: Needs review » Needs work
FileSize
8.57 KB

Combined patch, incremented forward some. Test is failing in an incomplete state, but no more time tonight for debug.

Grayside’s picture

Another increment forward on tests. Somewhat better code reuse, better encapsulation of group membership assertion, but still erroring out, now with a mysterious DB error followed by a no-argument warning.

Grayside’s picture

Assigned: Grayside » Unassigned
Status: Needs work » Needs review
FileSize
10.3 KB

Got it.

Grayside’s picture

Testbot seems jammed, but testing well on my local.

New patch adds a test for og_is_pending_member(), and wonder of wonders, fixes a bug with that function!

Grayside’s picture

Status: Needs review » Reviewed & tested by the community

Testbot approved. Setting to RTBC to create a shortlist of things I think are ready to commit with a quick second nomination.

Grayside’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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