зеркало из https://github.com/nextcloud/spreed.git
Add an endpoint for a media tab
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Родитель
9822c9fb1c
Коммит
2397bd4fae
|
@ -52,5 +52,7 @@ return [
|
|||
['name' => 'Chat#mentions', 'url' => '/api/{apiVersion}/chat/{token}/mentions', 'verb' => 'GET', 'requirements' => $requirements],
|
||||
/** @see \OCA\Talk\Controller\ChatController::shareObjectToChat() */
|
||||
['name' => 'Chat#shareObjectToChat', 'url' => '/api/{apiVersion}/chat/{token}/share', 'verb' => 'POST', 'requirements' => $requirements],
|
||||
/** @see \OCA\Talk\Controller\ChatController::getObjectsSharedInRoom() */
|
||||
['name' => 'Chat#getObjectsSharedInRoom', 'url' => '/api/{apiVersion}/chat/{token}/share', 'verb' => 'GET', 'requirements' => $requirements],
|
||||
],
|
||||
];
|
||||
|
|
|
@ -700,6 +700,37 @@ class ChatController extends AEnvironmentAwareController {
|
|||
return $this->setReadMarker($unreadId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @PublicPage
|
||||
* @RequireParticipant
|
||||
* @RequireReadWriteConversation
|
||||
* @RequireModeratorOrNoLobby
|
||||
*
|
||||
* @param int $offset
|
||||
* @param int $limit
|
||||
* @return DataResponse
|
||||
*/
|
||||
public function getObjectsSharedInRoom(int $offset = 0, int $limit = 50): DataResponse {
|
||||
$offset = max(0, $offset);
|
||||
$limit = min(200, $limit);
|
||||
|
||||
$comments = $this->chatManager->searchForObjects('', [$this->room->getId()], 'object_shared', $offset, $limit);
|
||||
|
||||
$messages = [];
|
||||
foreach ($comments as $comment) {
|
||||
$message = $this->messageParser->createMessage($this->room, $this->participant, $comment, $this->l);
|
||||
$this->messageParser->parseMessage($message);
|
||||
|
||||
if (!$message->getVisibility()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$messages[] = $message->toArray();
|
||||
}
|
||||
|
||||
return new DataResponse($messages);
|
||||
}
|
||||
|
||||
/**
|
||||
* @PublicPage
|
||||
* @RequireParticipant
|
||||
|
|
Загрузка…
Ссылка в новой задаче