Browse Source
Rename time to live to message expire
Signed-off-by: Vitor Mattos <vitor@php.rio>
pull/7327/head
Vitor Mattos
4 years ago
No known key found for this signature in database
GPG Key ID: B7AB4B76A7CA7318
6 changed files with
14 additions and
12 deletions
docs/conversation.md
lib/Chat/ChatManager.php
lib/Controller/RoomController.php
lib/Room.php
lib/Service/RoomService.php
tests/integration/features/bootstrap/FeatureContext.php
@ -51,7 +51,7 @@
`participantFlags` | int | v1 | | "In call" flags of the user's session making the request (only available with `in-call-flags` capability)
`readOnly` | int | v1 | | Read-only state for the current user (only available with `read-only-rooms` capability)
`listable` | int | v3 | | Listable scope for the room (only available with `listable-rooms` capability)
`timeToLive` | int | v4 | | The time to live of message s in this chat. Zero if disabled. (only available with `time-to-live` capability)
`messageExpire` | int | v4 | | The message expire time in second s in this chat. Zero if disabled. (only available with `time-to-live` capability)
`count` | int | v1 | v2 | **Removed:** Count the users on the [Get list of participants in a conversation ](participant.md#get-list-of-participants-in-a-conversation ) endpoint
`numGuests` | int | v1 | v2 | **Removed:** Count the guests on the [Get list of participants in a conversation ](participant.md#get-list-of-participants-in-a-conversation ) endpoin
`lastPing` | int | v1 | | Timestamp of the user's session making the request
@ -36,6 +36,7 @@ use OCA\Talk\Room;
use OCA\Talk\Service\AttachmentService ;
use OCA\Talk\Service\ParticipantService ;
use OCA\Talk\Service\PollService ;
use OCA\Talk\Service\RoomService ;
use OCA\Talk\Share\RoomShareProvider ;
use OCP\AppFramework\Utility\ITimeFactory ;
use OCP\Comments\IComment ;
@ -48,6 +49,7 @@ use OCP\ICacheFactory;
use OCP\IDBConnection ;
use OCP\IUser ;
use OCP\Notification\IManager as INotificationManager ;
use OCP\Server ;
use OCP\Share\Exceptions\ShareNotFound ;
use OCP\Share\IManager ;
use OCP\Share\IShare ;
@ -703,7 +705,7 @@ class ChatManager {
public function deleteExpiredMessages ( int $roomId , int $jobId ) : array {
$room = $this -> manager -> getRoomById ( $roomId );
$max = $this -> getMaxMessageExpireSeconds ( $room -> getTimeToLive ( ));
$max = $this -> getMaxMessageExpireSeconds ( Server :: get ( RoomService :: class ) -> getMessageExpire ( $room ));
$min = $this -> getMinMessageExpireSeconds ( $jobId );
$ids = $this -> commentsManager -> getMessageIdsByRoomIdInDateInterval ( $roomId , $min , $max );
@ -400,7 +400,7 @@ class RoomController extends AEnvironmentAwareController {
'lastCommonReadMessage' => 0 ,
'listable' => Room :: LISTABLE_NONE ,
'callFlag' => Participant :: FLAG_DISCONNECTED ,
'timeToLiv e' => 0 ,
'messageExpir e' => 0 ,
];
$lastActivity = $room -> getLastActivity ();
@ -467,7 +467,7 @@ class RoomController extends AEnvironmentAwareController {
'defaultPermissions' => $room -> getDefaultPermissions (),
'description' => $room -> getDescription (),
'listable' => $room -> getListable (),
'timeToLiv e' => $room -> getTimeToLive ( ),
'messageExpir e' => $this -> roomService -> getMessageExpire ( $room ),
]);
if ( $currentParticipant -> getAttendee () -> getReadPrivacy () === Participant :: PRIVACY_PUBLIC ) {
@ -162,7 +162,7 @@ class Room {
private int $type ;
private int $readOnly ;
private int $listable ;
private int $timeToLiv e ;
private int $messageExpir e ;
private int $lobbyState ;
private int $sipEnabled ;
private ? int $assignedSignalingServer ;
@ -196,7 +196,7 @@ class Room {
int $type ,
int $readOnly ,
int $listable ,
int $timeToLiv e ,
int $messageExpir e ,
int $lobbyState ,
int $sipEnabled ,
? int $assignedSignalingServer ,
@ -226,7 +226,7 @@ class Room {
$this -> type = $type ;
$this -> readOnly = $readOnly ;
$this -> listable = $listable ;
$this -> timeToLive = $timeToLiv e;
$this -> messageExpire = $messageExpir e;
$this -> lobbyState = $lobbyState ;
$this -> sipEnabled = $sipEnabled ;
$this -> assignedSignalingServer = $assignedSignalingServer ;
@ -288,10 +288,6 @@ class Room {
$this -> listable = $newState ;
}
public function getTimeToLive () : int {
return $this -> timeToLive ;
}
public function getLobbyState () : int {
$this -> validateTimer ();
return $this -> lobbyState ;
@ -575,4 +575,8 @@ class RoomService {
false
);
}
public function getMessageExpire ( $room ) : int {
return $room -> messageExpire ;
}
}
@ -2586,7 +2586,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$this -> sendRequest ( 'GET' , '/apps/spreed/api/' . $apiVersion . '/room/' . self :: $identifierToToken [ $identifier ]);
$room = $this -> getDataFromResponse ( $this -> response );
Assert :: assertEquals ( $messageExpire , $room [ 'timeToLiv e' ]);
Assert :: assertEquals ( $messageExpire , $room [ 'messageExpir e' ]);
}
/**