Browse Source

Merge branch 'feature/mark-as-read-last-event-handling' into dev

Simounet 5 years ago
parent
commit
ad8927f47e
2 changed files with 5 additions and 7 deletions
  1. 1 6
      MysqlEntity.class.php
  2. 4 1
      action.php

+ 1 - 6
MysqlEntity.class.php

@@ -235,13 +235,8 @@ class MysqlEntity
             if($i){$query .=',';}else{$i=true;}
             $query .= '`'.$column.'`="'.$this->secure($value, $column).'" ';
         }
-        $query .=' WHERE ';
+        $query .= $this->getWhereClause($columns2, $operation);
 
-        $i = false;
-        foreach ($columns2 as $column=>$value){
-            if($i){$query .='AND ';}else{$i=true;}
-            $query .= '`'.$column.'`'.$operation.'"'.$this->secure($value, $column).'" ';
-        }
         if($this->debug)echo '<hr>'.$this->CLASS_NAME.' ('.__METHOD__ .') : Requete --> '.$query.'<br>'.$this->dbconnector->connection->error;
         $this->customQuery($query);
     }

+ 4 - 1
action.php

@@ -75,6 +75,7 @@ switch ($action){
         $whereClause = array();
         $whereClause['unread'] = '1';
         if(isset($_['feed']))$whereClause['feed'] = $_['feed'];
+        if(isset($_['last-event-id']))$whereClause['id'] = '<= ' . $_['last-event-id'];
         $eventManager->change(array('unread'=>'0'),$whereClause);
         if(!$ajaxCall){
             header('location: ./index.php');
@@ -87,7 +88,9 @@ switch ($action){
         $feeds = $feedManager->loadAllOnlyColumn('id',array('folder'=>$_['folder']));
 
         foreach($feeds as $feed){
-            $eventManager->change(array('unread'=>'0'),array('feed'=>$feed->getId()));
+            $whereClause['feed'] = $feed->getId();
+            if(isset($_['last-event-id']))$whereClause['id'] = '<= ' . $_['last-event-id'];
+            $eventManager->change(array('unread'=>'0'),$whereClause);
         }
 
         if (!$ajaxCall){