This patch gets the module into working order in Drupal 7.

I've found and fixed a number of issues, and fixing them is critical to my current project so for speed, I've rolled it all into one patch.

It fixes as follows:
- Views handler: Instead of adding expressions and multiple where's, It simply looks up all the UIDs first and then passes those to the query. This is probably better, performance wise, since there aren't two long WHERE IN() lookups and it makes sure to only include each UID once. Fixes http://drupal.org/node/1012296
- flag_friend_determine_friend_status() - This query was also broken, making the Flag Friend links and other things not work. I simplified it into one line.
- $form_state on flag_friend_form_submit(). Fixes the error: "You do not have permission to flag or unflag this piece of content" when trying to unfriend. Changes the action value to "unflag" instead of "unfriend", so flag.module can understand it.
- Fixes "delete friend" query, replaces with simple one line query. In the current release, you can remove a friend but they don't disappear from the friends list. Checked the return of that delete query and it was always 0, meaning, no rows deleted.

Comments

jon pugh’s picture

StatusFileSize
new5.29 KB

attaching patch

jon pugh’s picture

By the way, this patch is heavily tested, as we are using the module for a major social networking site.

shawn dearmond’s picture

StatusFileSize
new4.66 KB

Patch works, but some of the DBTNG code was removed in favor of simple SELECT and DELETE statements. I put the DBTNG code back in (and fixed it so it works).

I suppose it's up to the maintainer which to use.

If the performance is THAT much better with a straight SQL query, then that works fine too.

Attached is the re-rolled patch.

sirkitree’s picture

Status: Needs review » Fixed

Yeah, as long as the DBTNG code works without creating IN selects, I'd rather keep DBTNG code. I'm also not a fan of a huge patch, but since we're still in alpha right now I'm going to commit this and we can move on. Thanks for the initial work @careerner and for the review @Shawn DeArmond.

http://drupalcode.org/project/flag_friend.git/commitdiff/bde22f16bc2190d...

Status: Fixed » Closed (fixed)

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

Sinan Erdem’s picture

Is this patch committed to the latest version (7.x alpha 9)? Because I am having the same problem stated on this issue: #1099696: Errors after "Remove friend"