Browse Source

fix chat get message api call

CauseFX 5 years ago
parent
commit
e83845f889
1 changed files with 2 additions and 1 deletions
  1. 2 1
      api/plugins/chat.php

+ 2 - 1
api/plugins/chat.php

@@ -161,7 +161,8 @@ class Chat extends Organizr
 			array(
 				'function' => 'fetchAll',
 				'query' => array(
-					'SELECT `username`, `gravatar`, `uid`, `date`, `message` FROM chatroom LIMIT ' . $this->config['CHAT-messageLoadLimit']
+					'SELECT `username`, `gravatar`, `uid`, `date`, `message` FROM (SELECT `username`, `gravatar`, `uid`, `date`, `message` FROM chatroom ORDER BY date DESC LIMIT ?) ORDER BY date ASC',
+					$this->config['CHAT-messageLoadLimit']
 				)
 			),
 		];