From 5fea4ed4f4b7801b54084c02c472f40116b61d05 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 29 Jul 2011 14:33:59 -0400 Subject: [PATCH] - Patch #1228888 by Johnny vd Laar: shortcut_set_unassign_user() deletes in the wrong table. --- modules/shortcut/shortcut.module | 2 +- modules/shortcut/shortcut.test | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/shortcut/shortcut.module b/modules/shortcut/shortcut.module index d2ac72b3206..8642d9de799 100644 --- a/modules/shortcut/shortcut.module +++ b/modules/shortcut/shortcut.module @@ -460,7 +460,7 @@ function shortcut_set_assign_user($shortcut_set, $account) { * to any set. */ function shortcut_set_unassign_user($account) { - $deleted = db_delete('shortcut_set') + $deleted = db_delete('shortcut_set_users') ->condition('uid', $account->uid) ->execute(); return (bool) $deleted; diff --git a/modules/shortcut/shortcut.test b/modules/shortcut/shortcut.test index e37e1e5f8e6..75a5a67bffb 100644 --- a/modules/shortcut/shortcut.test +++ b/modules/shortcut/shortcut.test @@ -312,6 +312,19 @@ class ShortcutSetsTestCase extends ShortcutTestCase { $this->assertNotEqual($set->title, $existing_title, t('The shortcut set %title cannot be renamed to %new-title because a shortcut set with that title already exists.', array('%title' => $set->title, '%new-title' => $existing_title))); } + /** + * Tests unassigning a shortcut set. + */ + function testShortcutSetUnassign() { + $new_set = $this->generateShortcutSet($this->randomName(10)); + + shortcut_set_assign_user($new_set, $this->shortcut_user); + shortcut_set_unassign_user($this->shortcut_user); + $current_set = shortcut_current_displayed_set($this->shortcut_user); + $default_set = shortcut_default_set($this->shortcut_user); + $this->assertTrue($current_set->set_name == $default_set->set_name, "Successfully unassigned another user's shortcut set."); + } + /** * Tests deleting a shortcut set. */