-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
- Loading branch information
1 parent
7e28286
commit 4711dde
Showing
74 changed files
with
6,028 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0"?> | ||
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd"> | ||
<id>user_status</id> | ||
<name>User status</name> | ||
<summary>User status</summary> | ||
<description><![CDATA[User status]]></description> | ||
<version>0.0.2</version> | ||
<licence>agpl</licence> | ||
<author mail="oc.list@georgehrke.com" >Georg Ehrke</author> | ||
<namespace>UserStatus</namespace> | ||
<default_enable/> | ||
<category>social</category> | ||
<bugs>https://github.com/nextcloud/server</bugs> | ||
<navigations> | ||
<navigation> | ||
<id>user_status-menuitem</id> | ||
<name>User status</name> | ||
<route /> | ||
<order>1</order> | ||
<icon>info.svg</icon> | ||
<type>settings</type> | ||
</navigation> | ||
</navigations> | ||
<dependencies> | ||
<nextcloud min-version="20" max-version="20"/> | ||
</dependencies> | ||
<background-jobs> | ||
<job>OCA\UserStatus\BackgroundJob\ClearOldStatusesBackgroundJob</job> | ||
</background-jobs> | ||
</info> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2020, Georg Ehrke | ||
* | ||
* @author Georg Ehrke <oc.list@georgehrke.com> | ||
* | ||
* @license AGPL-3.0 | ||
* | ||
* This code is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License, version 3, | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
|
||
return [ | ||
'ocs' => [ | ||
// Routes for querying statuses | ||
['name' => 'Statuses#findAll', 'url' => '/api/v1/statuses', 'verb' => 'GET'], | ||
['name' => 'Statuses#find', 'url' => '/api/v1/statuses/{userId}', 'verb' => 'GET'], | ||
// Routes for manipulating your own status | ||
['name' => 'UserStatus#getStatus', 'url' => '/api/v1/user_status', 'verb' => 'GET'], | ||
['name' => 'UserStatus#setStatus', 'url' => '/api/v1/user_status/status', 'verb' => 'PUT'], | ||
['name' => 'UserStatus#setPredefinedMessage', 'url' => '/api/v1/user_status/message/predefined', 'verb' => 'PUT'], | ||
['name' => 'UserStatus#setCustomMessage', 'url' => '/api/v1/user_status/message/custom', 'verb' => 'PUT'], | ||
['name' => 'UserStatus#clearMessage', 'url' => '/api/v1/user_status/message', 'verb' => 'DELETE'], | ||
// Routes for listing default routes | ||
['name' => 'PredefinedStatus#findAll', 'url' => '/api/v1/predefined_statuses/', 'verb' => 'GET'] | ||
], | ||
'routes' => [ | ||
['name' => 'Heartbeat#heartbeat', 'url' => '/heartbeat', 'verb' => 'PUT'], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* @copyright Copyright (c) 2020 Georg Ehrke | ||
* | ||
* @author Georg Ehrke <oc.list@georgehrke.com> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
.icon-user-status-away { | ||
@include icon-color('user-status-away', 'user_status', '#F4A331', 1); | ||
} | ||
|
||
.icon-user-status-dnd { | ||
@include icon-color('user-status-dnd', 'user_status', '#ED484C', 1); | ||
} | ||
|
||
.icon-user-status-invisible { | ||
@include icon-color('user-status-invisible', 'user_status', '#000000', 1); | ||
} | ||
|
||
.icon-user-status-online { | ||
@include icon-color('user-status-online', 'user_status', '#49B382', 2); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2020, Georg Ehrke | ||
* | ||
* @author Georg Ehrke <oc.list@georgehrke.com> | ||
* | ||
* @license AGPL-3.0 | ||
* | ||
* This code is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License, version 3, | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
|
||
namespace OCA\UserStatus\AppInfo; | ||
|
||
use OCA\UserStatus\Capabilities; | ||
use OCA\UserStatus\Listener\BeforeTemplateRenderedListener; | ||
use OCA\UserStatus\Listener\UserDeletedListener; | ||
use OCA\UserStatus\Listener\UserLiveStatusListener; | ||
use OCA\UserStatus\Service\JSDataService; | ||
use OCP\AppFramework\App; | ||
use OCP\AppFramework\Bootstrap\IBootContext; | ||
use OCP\AppFramework\Bootstrap\IBootstrap; | ||
use OCP\AppFramework\Bootstrap\IRegistrationContext; | ||
use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; | ||
use OCP\IInitialStateService; | ||
use OCP\User\Events\UserDeletedEvent; | ||
use OCP\User\Events\UserLiveStatusEvent; | ||
|
||
/** | ||
* Class Application | ||
* | ||
* @package OCA\UserStatus\AppInfo | ||
*/ | ||
class Application extends App implements IBootstrap { | ||
|
||
/** @var string */ | ||
public const APP_ID = 'user_status'; | ||
|
||
/** | ||
* Application constructor. | ||
* | ||
* @param array $urlParams | ||
*/ | ||
public function __construct(array $urlParams = []) { | ||
parent::__construct(self::APP_ID, $urlParams); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function register(IRegistrationContext $context): void { | ||
// Register OCS Capabilities | ||
$context->registerCapability(Capabilities::class); | ||
|
||
// Register Event Listeners | ||
$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); | ||
$context->registerEventListener(UserLiveStatusEvent::class, UserLiveStatusListener::class); | ||
$context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function boot(IBootContext $context): void { | ||
$appContainer = $context->getAppContainer(); | ||
|
||
/** @var IInitialStateService $initialState */ | ||
$initialState = $appContainer->query(IInitialStateService::class); | ||
$initialState->provideLazyInitialState(self::APP_ID, 'status', static function () use ($appContainer) { | ||
/** @var JSDataService $data */ | ||
$data = $appContainer->query(JSDataService::class); | ||
return $data; | ||
}); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2020, Georg Ehrke | ||
* | ||
* @author Georg Ehrke <oc.list@georgehrke.com> | ||
* | ||
* @license AGPL-3.0 | ||
* | ||
* This code is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License, version 3, | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
|
||
namespace OCA\UserStatus\BackgroundJob; | ||
|
||
use OCA\UserStatus\Db\UserStatusMapper; | ||
use OCP\AppFramework\Utility\ITimeFactory; | ||
use OCP\BackgroundJob\TimedJob; | ||
|
||
/** | ||
* Class ClearOldStatusesBackgroundJob | ||
* | ||
* @package OCA\UserStatus\BackgroundJob | ||
*/ | ||
class ClearOldStatusesBackgroundJob extends TimedJob { | ||
|
||
/** @var UserStatusMapper */ | ||
private $mapper; | ||
|
||
/** | ||
* ClearOldStatusesBackgroundJob constructor. | ||
* | ||
* @param ITimeFactory $time | ||
* @param UserStatusMapper $mapper | ||
*/ | ||
public function __construct(ITimeFactory $time, | ||
UserStatusMapper $mapper) { | ||
parent::__construct($time); | ||
$this->mapper = $mapper; | ||
|
||
// Run every 15 minutes | ||
$this->setInterval(60 * 15); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
protected function run($argument) { | ||
$this->mapper->clearOlderThan($this->time->getTime()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2020, Georg Ehrke | ||
* | ||
* @author Georg Ehrke <oc.list@georgehrke.com> | ||
* | ||
* @license AGPL-3.0 | ||
* | ||
* This code is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License, version 3, | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
namespace OCA\UserStatus; | ||
|
||
use OCA\UserStatus\Service\EmojiService; | ||
use OCP\Capabilities\ICapability; | ||
|
||
/** | ||
* Class Capabilities | ||
* | ||
* @package OCA\UserStatus | ||
*/ | ||
class Capabilities implements ICapability { | ||
|
||
/** @var EmojiService */ | ||
private $emojiService; | ||
|
||
/** | ||
* Capabilities constructor. | ||
* | ||
* @param EmojiService $emojiService | ||
*/ | ||
public function __construct(EmojiService $emojiService) { | ||
$this->emojiService = $emojiService; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getCapabilities() { | ||
return [ | ||
'user_status' => [ | ||
'enabled' => true, | ||
'supports_emoji' => $this->emojiService->doesPlatformSupportEmoji(), | ||
], | ||
]; | ||
} | ||
} |
Oops, something went wrong.