diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-06-03 16:31:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-03 16:31:21 +0300 |
commit | 71ada420b1da7d91a9e7e79bcc9818c5748f5531 (patch) | |
tree | f598fd71e75c0215aee33ce28162830e9a282629 /lib/Room.php | |
parent | 7c00fc29bf85925677d72eafdcbf18e4d1b39354 (diff) | |
parent | 6097eb20aa8e593f64ecf5494c3c43069337321f (diff) |
Merge pull request #7413 from nextcloud/techdebt/6235/set-description
Move setDescription to room service
Diffstat (limited to 'lib/Room.php')
-rw-r--r-- | lib/Room.php | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/lib/Room.php b/lib/Room.php index 49f6ca324..a965dda8c 100644 --- a/lib/Room.php +++ b/lib/Room.php @@ -359,6 +359,10 @@ class Room { return $this->description; } + public function setDescription(string $description): void { + $this->description = $description; + } + /** * @deprecated Use ParticipantService::getGuestCount() instead * @return int @@ -689,38 +693,6 @@ class Room { } /** - * @param string $description - * @return bool True when the change was valid, false otherwise - * @throws \LengthException when the given description is too long - */ - public function setDescription(string $description): bool { - $description = trim($description); - - if (mb_strlen($description) > self::DESCRIPTION_MAXIMUM_LENGTH) { - throw new \LengthException('Conversation description is limited to ' . self::DESCRIPTION_MAXIMUM_LENGTH . ' characters'); - } - - $oldDescription = $this->getDescription(); - if ($description === $oldDescription) { - return false; - } - - $event = new ModifyRoomEvent($this, 'description', $description, $oldDescription); - $this->dispatcher->dispatch(self::EVENT_BEFORE_DESCRIPTION_SET, $event); - - $update = $this->db->getQueryBuilder(); - $update->update('talk_rooms') - ->set('description', $update->createNamedParameter($description)) - ->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT))); - $update->executeStatement(); - $this->description = $description; - - $this->dispatcher->dispatch(self::EVENT_AFTER_DESCRIPTION_SET, $event); - - return true; - } - - /** * @param string $password Currently it is only allowed to have a password for Room::TYPE_PUBLIC * @return bool True when the change was valid, false otherwise */ |