From: Stéphane Jacob Date: Wed, 2 Nov 2011 12:50:21 +0000 (+0100) Subject: Fixes group notification on unsubscriptions. X-Git-Tag: xorg/1.1.4~39 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=593768bd0caac841bbe315a46a959cee639f44b9;p=platal.git Fixes group notification on unsubscriptions. Signed-off-by: Stéphane Jacob --- diff --git a/classes/group.php b/classes/group.php index 72ce770..846f2b2 100644 --- a/classes/group.php +++ b/classes/group.php @@ -160,6 +160,21 @@ class Group XDB::execute('DELETE FROM group_members WHERE uid = {?} AND asso_id = {?}', $uid, $group_id); + self::fix_notification($group_id); + } + + static private function fix_notification($group_id) + { + $count = XDB::fetchOneCell("SELECT COUNT(uid) + FROM group_members + WHERE asso_id = {?} AND perms = 'admin' AND FIND_IN_SET('notify', flags)", + $group_id); + if ($count == 0) { + XDB::execute("UPDATE groups + SET flags = IF(flags = '', 'notify_all', CONCAT(flags, ',', 'notify_all')) + WHERE id = {?}", + $group_id); + } } }