Skip to content

Commit

Permalink
feat(dashboard): Create default conversations when loading the dashboard
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Jan 9, 2025
1 parent a3f36d2 commit 17a918d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Dashboard/TalkWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Chat\MessageParser;
use OCA\Talk\Config;
use OCA\Talk\Events\BeforeRoomsFetchEvent;
use OCA\Talk\Manager;
use OCA\Talk\Model\BreakoutRoom;
use OCA\Talk\Model\Message;
Expand All @@ -49,6 +50,7 @@
use OCP\Dashboard\Model\WidgetItem;
use OCP\Dashboard\Model\WidgetItems;
use OCP\Dashboard\Model\WidgetOptions;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUser;
Expand All @@ -68,6 +70,7 @@ public function __construct(
protected MessageParser $messageParser,
protected ChatManager $chatManager,
protected ProxyCacheMessageService $pcmService,
protected IEventDispatcher $dispatcher,
protected ITimeFactory $timeFactory,
) {
}
Expand Down Expand Up @@ -147,6 +150,9 @@ public function load(): void {
}

public function getItems(string $userId, ?string $since = null, int $limit = 7): array {
$event = new BeforeRoomsFetchEvent($userId);
$this->dispatcher->dispatchTyped($event);

$rooms = $this->manager->getRoomsForUser($userId, [], true);

$rooms = array_filter($rooms, function (Room $room) use ($userId) {
Expand Down Expand Up @@ -187,6 +193,9 @@ public function getItems(string $userId, ?string $since = null, int $limit = 7):
* @inheritDoc
*/
public function getItemsV2(string $userId, ?string $since = null, int $limit = 7): WidgetItems {
$event = new BeforeRoomsFetchEvent($userId);
$this->dispatcher->dispatchTyped($event);

$allRooms = $this->manager->getRoomsForUser($userId, [], true);

$rooms = [];
Expand Down

0 comments on commit 17a918d

Please sign in to comment.