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

[stable30] feat(dashboard): Create default conversations when loading the dashboard #14089

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/Dashboard/TalkWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,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 @@ -31,6 +32,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 @@ -50,6 +52,7 @@ public function __construct(
protected MessageParser $messageParser,
protected ChatManager $chatManager,
protected ProxyCacheMessageService $pcmService,
protected IEventDispatcher $dispatcher,
protected ITimeFactory $timeFactory,
) {
}
Expand Down Expand Up @@ -129,6 +132,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 @@ -169,6 +175,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
Loading