Skip to content

Commit

Permalink
show a nice message, if the entity offers one
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
  • Loading branch information
blizzz committed Nov 29, 2019
1 parent 2b955bc commit 2abc7dd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/Flow/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserSession;
use OCP\WorkflowEngine\EntityContext\IDisplayText;
use OCP\WorkflowEngine\IManager as FlowManager;
use OCP\WorkflowEngine\IOperation;
use OCP\WorkflowEngine\IRuleMatcher;
Expand Down Expand Up @@ -121,6 +122,15 @@ public function onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatch
$uid = $flow['scope_actor_id'];
$this->validateOperationConfig($mode, $token, $uid);

$entity = $ruleMatcher->getEntity();

$message = $eventName;
if($entity instanceof IDisplayText) {
$message = $entity->getDisplayText(3);
if($message === '') {
continue;
}
}

$room = $this->getRoom($token, $uid);
$participant = $this->getParticipant($uid, $room);
Expand All @@ -129,7 +139,7 @@ public function onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatch
$participant,
'bots',
$participant->getUser(),
$this->prepareMention($mode, $participant) . 'MESSAGE TODO',
$this->prepareMention($mode, $participant) . $message,
new \DateTime(),
null
);
Expand Down

0 comments on commit 2abc7dd

Please sign in to comment.