Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7ae69c8
feat(webhooks): Start with implementing webhooks for chat messages
nickvergessen Jan 2, 2023
fac8f13
feat(Message): Allow parsing messages without a current participant
nickvergessen Jul 19, 2023
b1a89a8
feat(bots): Allow to read system messages as well
nickvergessen Jul 19, 2023
fa5f671
fix(bots): Set the OCS APIRequest header so Nextclouds can be the Bot…
nickvergessen Jul 19, 2023
38aaa0c
fix(bots): Set timeout to 5s (we wait async if necessary)
nickvergessen Aug 2, 2023
6b6090e
feat(bots): Add commands and events to install bots
nickvergessen Jul 23, 2023
71ee2c8
fix(bots): Use the fixed CLI url
nickvergessen Jul 24, 2023
65893d2
feat(bots): Add API to list, enable and disable bots in a conversation
nickvergessen Jul 26, 2023
395cb5c
ci(psalm): Fix psalm issues and baseline
nickvergessen Jul 27, 2023
bf86dca
docs: Add occ docs for bot commands
nickvergessen Jul 27, 2023
aa32008
fix(bots): Update name, description and state when reinstalling only
nickvergessen Jul 27, 2023
ac3d82e
fix(bots): Return Bot data when enabling/disabling
nickvergessen Jul 27, 2023
5a68ea2
tests(integration): Add integration tests for the call summary bot
nickvergessen Aug 2, 2023
b66fd19
fix: Fix code quality based on review
nickvergessen Aug 4, 2023
4ae7a45
fix: Typo in row attribute names
nickvergessen Aug 7, 2023
49e69db
fix(chat): Fix actor detection when type and id are provided
nickvergessen Aug 7, 2023
13c5ced
feat(bot): Allow reactions by bots
nickvergessen Aug 7, 2023
e2de469
fix: Block bot commands on incompatible versions
nickvergessen Aug 7, 2023
957851e
fix(l10n): 27 is not using a non-breakable space
nickvergessen Aug 8, 2023
6d90f06
add section in ConversationSettingsDialog.vue for enabling / disablin…
Antreesy Aug 7, 2023
9e9fd95
fix(CI): Bump nextcloud/OCP package
nickvergessen Aug 8, 2023
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
Prev Previous commit
Next Next commit
feat(Message): Allow parsing messages without a current participant
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Aug 8, 2023
commit fac8f13a7c381d62966f47754a58e89413a251ca
2 changes: 1 addition & 1 deletion lib/Chat/MessageParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __construct(
$this->userManager = $userManager;
}

public function createMessage(Room $room, Participant $participant, IComment $comment, IL10N $l): Message {
public function createMessage(Room $room, ?Participant $participant, IComment $comment, IL10N $l): Message {
return new Message($room, $participant, $comment, $l);
}

Expand Down
1 change: 1 addition & 0 deletions lib/Chat/Parser/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function parseMessage(Message $message): void {

$participant = $message->getParticipant();
if ($data['visibility'] !== \OCA\Talk\Model\Command::RESPONSE_ALL &&
$participant !== null &&
($participant->getAttendee()->getActorType() !== Attendee::ACTOR_USERS
|| $data['user'] !== $participant->getAttendee()->getActorId())) {
$message->setVisibility(false);
Expand Down
11 changes: 8 additions & 3 deletions lib/Chat/Parser/SystemMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ public function parseMessage(Message $chatMessage): void {
$parsedParameters = ['actor' => $this->getActorFromComment($room, $comment)];

$participant = $chatMessage->getParticipant();
if (!$participant->isGuest()) {
if ($participant === null) {
$currentActorId = null;
$currentUserIsActor = false;
} elseif (!$participant->isGuest()) {
$currentActorId = $participant->getAttendee()->getActorId();
$currentUserIsActor = $parsedParameters['actor']['type'] === 'user' &&
$participant->getAttendee()->getActorType() === Attendee::ACTOR_USERS &&
Expand Down Expand Up @@ -583,12 +586,14 @@ public function parseDeletedMessage(Message $chatMessage): void {
$parsedParameters = ['actor' => $this->getActor($room, $data['deleted_by_type'], $data['deleted_by_id'])];

$participant = $chatMessage->getParticipant();
$currentActorId = $participant->getAttendee()->getActorId();
$currentActorId = $participant?->getAttendee()->getActorId();

$authorIsActor = $data['deleted_by_type'] === $chatMessage->getComment()->getActorType()
&& $data['deleted_by_id'] === $chatMessage->getComment()->getActorId();

if (!$participant->isGuest()) {
if ($participant === null) {
$currentUserIsActor = false;
} elseif (!$participant->isGuest()) {
$currentUserIsActor = $parsedParameters['actor']['type'] === 'user' &&
$participant->getAttendee()->getActorType() === Attendee::ACTOR_USERS &&
$currentActorId === $parsedParameters['actor']['id'];
Expand Down
4 changes: 2 additions & 2 deletions lib/Chat/Parser/UserMention.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public function parseMessage(Message $chatMessage): void {

if ($mention['type'] === 'call') {
$userId = '';
if ($chatMessage->getParticipant()->getAttendee()->getActorType() === Attendee::ACTOR_USERS) {
$userId = $chatMessage->getParticipant()->getAttendee()->getActorId();
if ($chatMessage->getParticipant()?->getAttendee()->getActorType() === Attendee::ACTOR_USERS) {
$userId = $chatMessage->getParticipant()?->getAttendee()->getActorId();
}

$messageParameters[$mentionParameterId] = [
Expand Down
6 changes: 3 additions & 3 deletions lib/Model/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Message {
/** @var IL10N */
protected $l;

/** @var Participant */
/** @var null|Participant */
protected $participant;

/** @var bool */
Expand Down Expand Up @@ -67,7 +67,7 @@ class Message {
protected $actorDisplayName = '';

public function __construct(Room $room,
Participant $participant,
?Participant $participant,
IComment $comment,
IL10N $l) {
$this->room = $room;
Expand All @@ -92,7 +92,7 @@ public function getL10n(): IL10N {
return $this->l;
}

public function getParticipant(): Participant {
public function getParticipant(): ?Participant {
return $this->participant;
}

Expand Down