]> git.mxchange.org Git - friendica.git/commitdiff
Add the notify type to the notification query
authorMichael <heluecht@pirati.ca>
Sun, 5 Jun 2022 15:02:03 +0000 (15:02 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 5 Jun 2022 15:02:03 +0000 (15:02 +0000)
database.sql
doc/database/db_notification.md
src/Navigation/Notifications/Repository/Notification.php
static/dbstructure.config.php

index 57ce736f13d0ed3a9761e2f541832148edf3037e..c0c5f78358a7c0b5ff4f1020bbe7a2b84401548b 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2022.05-rc (Siberian Iris)
--- DB_UPDATE_VERSION 1466
+-- DB_UPDATE_VERSION 1467
 -- ------------------------------------------
 
 
@@ -848,7 +848,7 @@ CREATE TABLE IF NOT EXISTS `notification` (
        `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
        `uid` mediumint unsigned COMMENT 'Owner User id',
        `vid` smallint unsigned COMMENT 'Id of the verb table entry that contains the activity verbs',
-       `type` tinyint unsigned COMMENT '',
+       `type` smallint unsigned COMMENT '',
        `actor-id` int unsigned COMMENT 'Link to the contact table with uid=0 of the actor that caused the notification',
        `target-uri-id` int unsigned COMMENT 'Item-uri id of the related post',
        `parent-uri-id` int unsigned COMMENT 'Item-uri id of the parent of the related post',
index 7c7dc3a543d9dc78a8f61f2c69672341fc4aef7c..e79778cb5b0cbf1a7a918a9927ca8f10269abfb4 100644 (file)
@@ -11,7 +11,7 @@ Fields
 | id            | sequential ID                                                                  | int unsigned       | NO   | PRI | NULL    | auto_increment |
 | uid           | Owner User id                                                                  | mediumint unsigned | YES  |     | NULL    |                |
 | vid           | Id of the verb table entry that contains the activity verbs                    | smallint unsigned  | YES  |     | NULL    |                |
-| type          |                                                                                | tinyint unsigned   | YES  |     | NULL    |                |
+| type          |                                                                                | smallint unsigned  | YES  |     | NULL    |                |
 | actor-id      | Link to the contact table with uid=0 of the actor that caused the notification | int unsigned       | YES  |     | NULL    |                |
 | target-uri-id | Item-uri id of the related post                                                | int unsigned       | YES  |     | NULL    |                |
 | parent-uri-id | Item-uri id of the parent of the related post                                  | int unsigned       | YES  |     | NULL    |                |
index 7c3a65fc090c61d0f47f72f7dd60b1a3cb587262..e61ea57e2aaf04bdd7eea8e36d5a9a2ca6a5e480 100644 (file)
@@ -117,7 +117,7 @@ class Notification extends BaseRepository
         */
        public function selectDetailedForUser(int $uid): Collection\Notifications
        {
-               $condition = [];
+               $condition = ["`type` & ? != 0", $this->pconfig->get($uid, 'system', 'notify_type', 3 | 72 | 4 | 16 | 32) | 128 | 256];
                if (!$this->pconfig->get($uid, 'system', 'notify_like')) {
                        $condition = DBA::mergeConditions($condition, ['`vid` != ?', Verb::getID(\Friendica\Protocol\Activity::LIKE)]);
                }
@@ -138,7 +138,7 @@ class Notification extends BaseRepository
         */
        public function selectDigestForUser(int $uid): Collection\Notifications
        {
-               $values = [$uid];
+               $values = [$uid, $this->pconfig->get($uid, 'system', 'notify_type', 3 | 72 | 4 | 16 | 32) | 128 | 256];
 
                $like_condition = '';
                if (!$this->pconfig->get($uid, 'system', 'notify_like')) {
@@ -158,7 +158,7 @@ class Notification extends BaseRepository
                WHERE `id` IN (
                    SELECT MAX(`id`)
                    FROM `notification`
-                   WHERE `uid` = ?
+                   WHERE `uid` = ? AND `type` & ? != 0
                    $like_condition
                    $announce_condition
                    GROUP BY IFNULL(`parent-uri-id`, `actor-id`)
index 1594175b1b44b175486b0891f28c1b9e3aff5d48..642e1667bdd07cdfcbe331b5098fe2d1e5a0f7df 100644 (file)
@@ -55,7 +55,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1466);
+       define('DB_UPDATE_VERSION', 1467);
 }
 
 return [
@@ -902,7 +902,7 @@ return [
                        "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
                        "uid" => ["type" => "mediumint unsigned", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
                        "vid" => ["type" => "smallint unsigned", "foreign" => ["verb" => "id", "on delete" => "restrict"], "comment" => "Id of the verb table entry that contains the activity verbs"],
-                       "type" => ["type" => "tinyint unsigned", "comment" => ""],
+                       "type" => ["type" => "smallint unsigned", "comment" => ""],
                        "actor-id" => ["type" => "int unsigned", "foreign" => ["contact" => "id"], "comment" => "Link to the contact table with uid=0 of the actor that caused the notification"],
                        "target-uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Item-uri id of the related post"],
                        "parent-uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],