Adds flags to distinguish notified animators on xnet.
authorStéphane Jacob <sj@m4x.org>
Wed, 2 Nov 2011 10:46:57 +0000 (11:46 +0100)
committerStéphane Jacob <sj@m4x.org>
Wed, 2 Nov 2011 10:46:57 +0000 (11:46 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
classes/userfilter/conditions.inc.php
upgrade/1.1.4/11_groups.sql [new file with mode: 0644]

index 2604a37..bb9ad83 100644 (file)
@@ -858,12 +858,19 @@ class UFC_NLSubscribed extends UserFilterCondition
  */
 class UFC_Group extends UserFilterCondition
 {
+    const BOTH = 0;
+    const NOTIFIED = 1;
+    const UNNOTIFIED = 2;
+
     private $group;
     private $anim;
-    public function __construct($group, $anim = false)
+    private $notified;
+
+    public function __construct($group, $anim = false, $notified = self::BOTH)
     {
         $this->group = $group;
         $this->anim = $anim;
+        $this->notified = $notified;
     }
 
     public function buildCondition(PlFilter $uf)
@@ -877,6 +884,10 @@ class UFC_Group extends UserFilterCondition
         if ($this->anim) {
             $where .= ' AND gpm' . $sub . '.perms = \'admin\'';
         }
+        if ($this->notified != self::BOTH) {
+            $where .= ' AND ' . ($this->notified == self::UNNOTIFIED ? 'NOT ' : '')
+                   . "FIND_IN_SET('notify', gpm" . $sub . '.flags)';
+        }
         return $where;
     }
 }
diff --git a/upgrade/1.1.4/11_groups.sql b/upgrade/1.1.4/11_groups.sql
new file mode 100644 (file)
index 0000000..6910c8e
--- /dev/null
@@ -0,0 +1,3 @@
+ALTER TABLE group_members ADD COLUMN flags SET('notify') NOT NULL DEFAULT '';
+
+-- vim:set syntax=mysql: