fix(retention): Exclude future meeting conversation from retention, not past ones

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2025-05-22 10:40:52 +02:00
parent ad72532133
commit fd1b5fae19
No known key found for this signature in database
GPG key ID: F72FA5B49FFA96B0
2 changed files with 21 additions and 3 deletions

View file

@ -58,7 +58,8 @@ class ExpireObjectRooms extends TimedJob {
foreach ($rooms as $room) {
if ($objectType === Room::OBJECT_TYPE_EVENT) {
[, $endTime] = explode('#', $room->getObjectId());
if ($endTime < $now) {
if ($endTime >= $minimumLastActivity) {
// Event time is in the future, so don't even consider deleting
continue;
}
}

View file

@ -60,12 +60,13 @@ Feature: conversation/delete-room
Then user "participant1" is participant of room "room" (v4)
And user "participant2" is not participant of room "room" (v4)
Scenario: Automatic retention
Scenario: Automatic retention of a past event conversation
Given user "participant1" creates room "room" (v4)
| roomType | 3 |
| roomName | room |
| objectType | event |
| objectId | 1740204000#1740207600 |
# 100 days in the past
| objectId | -8640000#-8643600 |
And user "participant1" is participant of room "room" (v4)
# Room is new
When force run "OCA\Talk\BackgroundJob\ExpireObjectRooms" background jobs
@ -79,3 +80,19 @@ Feature: conversation/delete-room
And age room "room" 32 days
When force run "OCA\Talk\BackgroundJob\ExpireObjectRooms" background jobs
Then user "participant1" is not participant of room "room" (v4)
Scenario: No retention of a future event conversation
Given user "participant1" creates room "room" (v4)
| roomType | 3 |
| roomName | room |
| objectType | event |
# 100 days in the future
| objectId | 8640000#8643600 |
And user "participant1" is participant of room "room" (v4)
# Room is new
When force run "OCA\Talk\BackgroundJob\ExpireObjectRooms" background jobs
And user "participant1" is participant of room "room" (v4)
# Still aging to put the last activity into the past
And age room "room" 32 days
When force run "OCA\Talk\BackgroundJob\ExpireObjectRooms" background jobs
Then user "participant1" is participant of room "room" (v4)