feat: add meeting activities

pull/77/head
sualko 2020-09-22 16:02:18 +02:00
parent 79921b6061
commit 130ae04881
10 changed files with 321 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="32"
width="32"
version="1.0"
viewBox="0 0 32 32"
id="svg4"
sodipodi:docname="meeting-ended.svg"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
inkscape:export-filename="/home/klaus/Repos/cloud_bbb/img/actions/meeting-started.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1479"
inkscape:window-height="997"
id="namedview6"
showgrid="false"
inkscape:zoom="10.429825"
inkscape:cx="-15.100081"
inkscape:cy="6.1114182"
inkscape:window-x="1889"
inkscape:window-y="504"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" />
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.48244119;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="M 6.140625,2 C 3.8448872,2 2,3.9362265 2,6.2421875 V 25.757812 C 2,28.063773 3.8448872,30 6.140625,30 h 19.71875 C 28.155113,30 30,28.063773 30,25.757812 V 6.2421875 C 30,3.9362265 28.155113,2 25.859375,2 Z m 0,2.4824219 h 19.71875 c 0.917462,0 1.658203,0.7417266 1.658203,1.7597656 V 25.757812 c 0,1.01804 -0.740741,1.759766 -1.658203,1.759766 H 6.140625 c -0.9174623,0 -1.6582031,-0.741726 -1.6582031,-1.759766 V 6.2421875 c 0,-1.018039 0.7407408,-1.7597656 1.6582031,-1.7597656 z"
id="rect817"
inkscape:connector-curvature="0" />
<rect
style="opacity:1;fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.70519036;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
id="rect820"
width="13.231286"
height="13.231286"
x="9.3843575"
y="9.3843575"
rx="0"
ry="0" />
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="32"
width="32"
version="1.0"
viewBox="0 0 32 32"
id="svg4"
sodipodi:docname="meeting-started.svg"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
inkscape:export-filename="/home/klaus/Repos/cloud_bbb/img/actions/room-created.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1479"
inkscape:window-height="997"
id="namedview6"
showgrid="false"
inkscape:zoom="10.429825"
inkscape:cx="-15.100081"
inkscape:cy="6.1114182"
inkscape:window-x="1889"
inkscape:window-y="504"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" />
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.48244119;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="M 6.140625,2 C 3.8448872,2 2,3.9362265 2,6.2421875 V 25.757812 C 2,28.063773 3.8448872,30 6.140625,30 h 19.71875 C 28.155113,30 30,28.063773 30,25.757812 V 6.2421875 C 30,3.9362265 28.155113,2 25.859375,2 Z m 0,2.4824219 h 19.71875 c 0.917462,0 1.658203,0.7417266 1.658203,1.7597656 V 25.757812 c 0,1.01804 -0.740741,1.759766 -1.658203,1.759766 H 6.140625 c -0.9174623,0 -1.6582031,-0.741726 -1.6582031,-1.759766 V 6.2421875 c 0,-1.018039 0.7407408,-1.7597656 1.6582031,-1.7597656 z"
id="rect817"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.66666603px;line-height:125%;font-family:'Helvetica Neue';-inkscape-font-specification:'Helvetica Neue';letter-spacing:0px;word-spacing:0px;fill:#44aa00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="4.2549443"
y="20.848959"
id="text816"><tspan
sodipodi:role="line"
id="tspan814"
x="4.2549443"
y="20.848959"> ▶</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="32"
width="32"
version="1.0"
viewBox="0 0 32 32"
id="svg4"
sodipodi:docname="recording-ready.svg"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
inkscape:export-filename="/home/klaus/Repos/cloud_bbb/img/actions/meeting-ended.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1479"
inkscape:window-height="997"
id="namedview6"
showgrid="false"
inkscape:zoom="10.429825"
inkscape:cx="-15.100081"
inkscape:cy="5.6320238"
inkscape:window-x="1889"
inkscape:window-y="504"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" />
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.48244119;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="M 6.140625,2 C 3.8448872,2 2,3.9362265 2,6.2421875 V 25.757812 C 2,28.063773 3.8448872,30 6.140625,30 h 19.71875 C 28.155113,30 30,28.063773 30,25.757812 V 6.2421875 C 30,3.9362265 28.155113,2 25.859375,2 Z m 0,2.4824219 h 19.71875 c 0.917462,0 1.658203,0.7417266 1.658203,1.7597656 V 25.757812 c 0,1.01804 -0.740741,1.759766 -1.658203,1.759766 H 6.140625 c -0.9174623,0 -1.6582031,-0.741726 -1.6582031,-1.759766 V 6.2421875 c 0,-1.018039 0.7407408,-1.7597656 1.6582031,-1.7597656 z"
id="rect817"
inkscape:connector-curvature="0" />
<circle
style="opacity:1;fill:#008000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.81180269;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
id="path841"
cx="16"
cy="16"
r="7.3826737" />
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,63 @@
<?php
namespace OCA\BigBlueButton\Activity;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\Activity\IManager as IActivityManager;
use OCA\BigBlueButton\Event\MeetingStartedEvent;
use OCA\BigBlueButton\Event\MeetingEndedEvent;
use OCA\BigBlueButton\Event\RecordingReadyEvent;
use OCA\BigBlueButton\AppInfo\Application;
use OCP\IUserSession;
class MeetingListener implements IEventListener {
/** @var IActivityManager */
private $activityManager;
/** @var IUserSession */
private $userSession;
public function __construct(
IActivityManager $activityManager,
IUserSession $userSession) {
$this->activityManager = $activityManager;
$this->userSession = $userSession;
}
public function handle(Event $event): void {
if ($event instanceof MeetingStartedEvent) {
$subject = Provider::MEETING_STARTED;
} elseif ($event instanceof MeetingEndedEvent) {
$subject = Provider::MEETING_ENDED;
} elseif ($event instanceof RecordingReadyEvent) {
$subject = Provider::RECORDING_READY;
} else {
return;
}
$room = $event->getRoom();
$activityEvent = $this->activityManager->generateEvent();
if (!$this->userSession->isLoggedIn()) {
$activityEvent->setAuthor($room->getUserId());
}
$subjectData = [
'id' => $room->getId(),
'name' => $room->getName(),
];
if ($event instanceof MeetingEndedEvent) {
$subjectData['recordingMarks'] = $event->hasRecordingMarks();
}
$activityEvent->setApp(Application::ID);
$activityEvent->setType(Setting::Identifier);
$activityEvent->setAffectedUser($room->getUserId());
$activityEvent->setSubject($subject, $subjectData);
$this->activityManager->publish($activityEvent);
}
}

View File

@ -28,6 +28,15 @@ class Provider implements IProvider {
/** @var string */
public const SHARE_DELETED = 'share_deleted';
/** @var string */
public const MEETING_STARTED = 'meeting_started';
/** @var string */
public const MEETING_ENDED = 'meeting_ended';
/** @var string */
public const RECORDING_READY = 'recording_ready';
/** @var IL10N */
protected $l;
@ -77,6 +86,12 @@ class Provider implements IProvider {
$this->parseShareCreated($event);
} elseif ($subject === self::SHARE_DELETED) {
$this->parseShareDeleted($event);
} elseif ($subject === self::MEETING_STARTED) {
$this->parseMeetingStarted($event);
} elseif ($subject === self::MEETING_ENDED) {
$this->parseMeetingEnded($event);
} elseif ($subject === self::RECORDING_READY) {
$this->parseRecordingReady($event);
}
return $event;
@ -140,6 +155,38 @@ class Provider implements IProvider {
$this->setIcon($event, 'share-deleted');
}
private function parseMeetingStarted(IEvent $event) {
$params = $event->getSubjectParameters();
if ($this->activityManager->getCurrentUserId() === $event->getAuthor()) {
$subject = $this->l->t('You started a meeting in the "%s" room.', [$params['name']]);
} else {
$subject = $this->l->t('{user} started a meeting in the "%s" room.', [$params['name']]);
}
$this->setSubjects($event, $subject, [
'user' => $this->getUser($event->getAuthor()),
]);
$this->setIcon($event, 'meeting-started');
}
private function parseMeetingEnded(IEvent $event) {
$params = $event->getSubjectParameters();
$event->setParsedSubject($this->l->t('The meeting in room "%s" has ended.', [$params['name']]));
$this->setIcon($event, 'meeting-ended');
}
private function parseRecordingReady(IEvent $event) {
$params = $event->getSubjectParameters();
$event->setParsedSubject($this->l->t('Recording for room "%s" is ready.', [$params['name']]));
$this->setIcon($event, 'recording-ready');
}
private function setIcon(IEvent $event, string $baseName) {
if ($this->activityManager->getRequirePNG()) {
$imagePath = $this->url->imagePath(Application::ID, 'actions/'.$baseName.'.png');

View File

@ -14,6 +14,10 @@ use \OCA\BigBlueButton\Activity\RoomListener;
use \OCA\BigBlueButton\Event\RoomShareCreatedEvent;
use \OCA\BigBlueButton\Event\RoomShareDeletedEvent;
use \OCA\BigBlueButton\Activity\RoomShareListener;
use \OCA\BigBlueButton\Event\MeetingStartedEvent;
use \OCA\BigBlueButton\Event\MeetingEndedEvent;
use \OCA\BigBlueButton\Event\RecordingReadyEvent;
use \OCA\BigBlueButton\Activity\MeetingListener;
if ((@include_once __DIR__ . '/../../vendor/autoload.php') === false) {
throw new \Exception('Cannot include autoload. Did you run install dependencies using composer?');
@ -35,6 +39,10 @@ class Application extends App {
$dispatcher->addServiceListener(RoomShareCreatedEvent::class, RoomShareListener::class);
$dispatcher->addServiceListener(RoomShareDeletedEvent::class, RoomShareListener::class);
$dispatcher->addServiceListener(MeetingStartedEvent::class, MeetingListener::class);
$dispatcher->addServiceListener(MeetingEndedEvent::class, MeetingListener::class);
$dispatcher->addServiceListener(RecordingReadyEvent::class, MeetingListener::class);
$container->registerMiddleWare(JoinMiddleware::class);
$container->registerMiddleWare(HookMiddleware::class);

View File

@ -4,7 +4,7 @@ namespace OCA\BigBlueButton\Event;
use OCA\BigBlueButton\Db\Room;
abstract class MeetingEndedEvent extends RoomEvent {
class MeetingEndedEvent extends RoomEvent {
private $recordingMarks = false;
public function __construct(Room $room, bool $recordingMarks) {