Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rooms): add option to automatically lock public and group rooms #13779

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

miaulalala
Copy link
Contributor

@miaulalala miaulalala commented Nov 14, 2024

…if they are inactive

Question - do we need to limit the room numbers to a certain amount per run of the BG job?

☑️ Resolves

🛠️ API Checklist

🚧 Tasks

  • ...

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not possible
  • 📘 API documentation in docs/ has been updated or is not required
  • 🔖 Capability is added or not needed

@miaulalala miaulalala added 2. developing feature: api 🛠️ OCS API for conversations, chats and participants feature: conversations 👥 labels Nov 14, 2024
@miaulalala miaulalala added this to the 🖤 Next Major (31) milestone Nov 14, 2024
@miaulalala miaulalala self-assigned this Nov 14, 2024
@miaulalala
Copy link
Contributor Author

/backport to stable30

@nickvergessen
Copy link
Member

do we need to limit the room numbers to a certain amount per run of the BG job?

Not for now

@@ -111,3 +111,4 @@ Legend:
| `conversations_files` | string<br>`1` or `0` | `1` | No | 🖌️ | Whether the files app integration is enabled allowing to start conversations in the right sidebar |
| `conversations_files_public_shares` | string<br>`1` or `0` | `1` | No | 🖌️ | Whether the public share integration is enabled allowing to start conversations in the right sidebar on the public share page (Requires `conversations_files` also to be enabled) |
| `enable_matterbridge` | string<br>`1` or `0` | `0` | No | 🖌️ | Whether the Matterbridge integration is enabled and can be configured |
| `inactivity_lock_time` | int | `0` | No | | A duration (in seconds) after which rooms are locked. Calculated from the last activity in the room. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the background jobs are only run hourly (I would even change it to daily),
I would make this config "days" of inactivity

Comment on lines +686 to +687
*
* @return int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*
* @return int

Not needed when the method has ): int {

$helper->selectRoomsTable($query);
$query->from('talk_rooms', 'r')
->andWhere($query->expr()->lte('r.last_activity', $query->createNamedParameter($inactiveSince, IQueryBuilder::PARAM_DATETIME_MUTABLE)))
->andWhere($query->expr()->lte('r.read_only', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
->andWhere($query->expr()->lte('r.read_only', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)))
->andWhere($query->expr()->neq('r.read_only', $query->createNamedParameter(Room::READ_ONLY, IQueryBuilder::PARAM_INT)))

return;
}
$timestamp = $this->time->getTime() - $interval;
$time = (new \DateTime())->setTimestamp($timestamp);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$time = (new \DateTime())->setTimestamp($timestamp);
$time = $this->time->getDateTime('@' . $timestamp);

$time = (new \DateTime())->setTimestamp($timestamp);
$rooms = $this->roomService->getInactiveRooms($time);
array_map(function (Room $room) {
$this->roomService->setReadOnly($room, Room::READ_ONLY);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log as info (or at least debug)?

@@ -1212,4 +1212,12 @@ public function deleteRoom(Room $room): void {
));
}
}

/**
* @param \DateTime $inactiveSince
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param \DateTime $inactiveSince

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Automatic locking of rooms after a certain time of inactivity
2 participants