summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2019-11-29 11:23:30 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2019-12-13 16:04:51 +0100
commit28a3e313648985a2ed2746ce79ee31a5e91f01f9 (patch)
treefdf73c863879d2f1f99e8d966ce1e0d7800dafb9 /lib
parent6258d21c7a01df48d5e29453090d3fa544cac8a1 (diff)
take a URL into consideration, if the entity provides one
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/Flow/Operation.php22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/Flow/Operation.php b/lib/Flow/Operation.php
index c43edb462..381c21170 100644
--- a/lib/Flow/Operation.php
+++ b/lib/Flow/Operation.php
@@ -37,6 +37,8 @@ use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserSession;
use OCP\WorkflowEngine\EntityContext\IDisplayText;
+use OCP\WorkflowEngine\EntityContext\IUrl;
+use OCP\WorkflowEngine\IEntity;
use OCP\WorkflowEngine\IManager as FlowManager;
use OCP\WorkflowEngine\IOperation;
use OCP\WorkflowEngine\IRuleMatcher;
@@ -124,12 +126,9 @@ class Operation implements IOperation {
$entity = $ruleMatcher->getEntity();
- $message = $eventName;
- if($entity instanceof IDisplayText) {
- $message = $entity->getDisplayText(3);
- if($message === '') {
- continue;
- }
+ $message = $this->prepareText($entity, $eventName);
+ if($message === '') {
+ continue;
}
$room = $this->getRoom($token, $uid);
@@ -153,6 +152,17 @@ class Operation implements IOperation {
}
}
+ protected function prepareText(IEntity $entity, string $eventName) {
+ $message = $eventName;
+ if($entity instanceof IDisplayText) {
+ $message = trim($entity->getDisplayText(3));
+ }
+ if($entity instanceof IUrl && $message !== '') {
+ $message .= ' ' . $entity->getUrl();
+ }
+ return $message;
+ }
+
/**
* returns a mention including a trailing whitespace, or an empty string
*/