mirror of
https://github.com/netzbegruenung/circles.git
synced 2024-04-29 02:14:51 +02:00
New circles are treated as an "all user" activity - but no option for this being on/off #204
This commit is contained in:
parent
16a1daeb41
commit
a467946c51
11
js/admin.js
11
js/admin.js
|
@ -33,7 +33,8 @@ var elements = {
|
|||
// test_async_wait: null,
|
||||
members_limit: null,
|
||||
allow_linked_groups: null,
|
||||
allow_federated_circles: null
|
||||
allow_federated_circles: null,
|
||||
disable_notification_for_seen_users: null
|
||||
};
|
||||
|
||||
|
||||
|
@ -46,6 +47,7 @@ $(document).ready(function () {
|
|||
elements.members_limit = $('#members_limit');
|
||||
elements.allow_linked_groups = $('#allow_linked_groups');
|
||||
elements.allow_federated_circles = $('#allow_federated_circles');
|
||||
elements.disable_notification_for_seen_users = $('#disable_notification_for_seen_users');
|
||||
|
||||
// elements.test_async_wait.hide().on('click', function () {
|
||||
// self.refreshResult();
|
||||
|
@ -81,6 +83,10 @@ $(document).ready(function () {
|
|||
elements.allow_federated_circles.on('change', function () {
|
||||
saveChange();
|
||||
});
|
||||
|
||||
elements.disable_notification_for_seen_users.on('change', function () {
|
||||
saveChange();
|
||||
});
|
||||
|
||||
saveChange = function () {
|
||||
$.ajax({
|
||||
|
@ -91,12 +97,15 @@ $(document).ready(function () {
|
|||
allow_linked_groups: (elements.allow_linked_groups.is(
|
||||
':checked')) ? '1' : '0',
|
||||
allow_federated_circles: (elements.allow_federated_circles.is(
|
||||
':checked')) ? '1' : '0',
|
||||
disable_notification_for_seen_users: (elements.disable_notification_for_seen_users.is(
|
||||
':checked')) ? '1' : '0'
|
||||
}
|
||||
}).done(function (res) {
|
||||
elements.members_limit.val(res.membersLimit);
|
||||
elements.allow_linked_groups.prop('checked', (res.allowLinkedGroups === '1'));
|
||||
elements.allow_federated_circles.prop('checked', (res.allowFederatedCircles === '1'));
|
||||
elements.disable_notification_for_seen_users.prop('checked', (res.disableNotificationForSeenUsers === '1'));
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -71,13 +71,15 @@ var elements = {
|
|||
settingsName: null,
|
||||
settingsDesc: null,
|
||||
settingsLimit: null,
|
||||
settingsEntryLimit: null,
|
||||
settingsEntryLimit: null,
|
||||
settingsLink: null,
|
||||
settingsLinkAuto: null,
|
||||
settingsLinkFiles: null,
|
||||
settingsNotification: null,
|
||||
settingsEntryLink: null,
|
||||
settingsEntryLinkAuto: null,
|
||||
settingsEntryLinkFiles: null,
|
||||
settingsEntryNotification: null,
|
||||
settingsSave: null,
|
||||
|
||||
addMember: null,
|
||||
|
@ -139,9 +141,11 @@ var elements = {
|
|||
elements.settingsLink = $('#settings-link');
|
||||
elements.settingsLinkAuto = $('#settings-link-auto');
|
||||
elements.settingsLinkFiles = $('#settings-link-files');
|
||||
elements.settingsNotification = $('#settings-notification');
|
||||
elements.settingsEntryLink = $('#settings-entry-link');
|
||||
elements.settingsEntryLinkAuto = $('#settings-entry-link-auto');
|
||||
elements.settingsEntryLinkFiles = $('#settings-entry-link-files');
|
||||
elements.settingsEntryNotification = $('#settings-entry-notification');
|
||||
elements.settingsSave = $('#settings-submit');
|
||||
|
||||
elements.addMember = $('#addmember');
|
||||
|
|
|
@ -60,6 +60,7 @@ var curr = {
|
|||
allowed_linked_groups: 0,
|
||||
allowed_federated_circles: 0,
|
||||
allowed_circles: 0,
|
||||
disabled_notification_for_seen_users: 0,
|
||||
|
||||
defineCircle: function (data) {
|
||||
curr.circle = data.circle_id;
|
||||
|
|
|
@ -61,6 +61,8 @@ var settings = {
|
|||
(curr.circleSettings['allow_links_auto'] === 'true'));
|
||||
elements.settingsLinkFiles.prop('checked',
|
||||
(curr.circleSettings['allow_links_files'] === 'true'));
|
||||
elements.settingsNotification.prop('checked',
|
||||
(curr.circleSettings['disable_notification_for_seen_users'] === 'true'));
|
||||
|
||||
elements.settingsLink.on('change', function () {
|
||||
settings.interactUISettings();
|
||||
|
@ -86,6 +88,8 @@ var settings = {
|
|||
(elements.settingsLink.is(":checked")));
|
||||
settings.enableSetting(elements.settingsEntryLinkFiles, elements.settingsLinkFiles,
|
||||
(elements.settingsLink.is(":checked")));
|
||||
settings.enableSetting(elements.settingsEntryNotification, elements.settingsNotification,
|
||||
(elements.settingsNotification.is(":checked")));
|
||||
},
|
||||
|
||||
enableSetting: function (entry, input, enable) {
|
||||
|
|
|
@ -84,6 +84,7 @@ class NavigationController extends BaseController {
|
|||
'members_list' => $this->configService->getAppValue(ConfigService::CIRCLES_MEMBERS_LIMIT),
|
||||
'allowed_linked_groups' => $this->configService->getAppValue(ConfigService::CIRCLES_ALLOW_LINKED_GROUPS),
|
||||
'allowed_federated_circles' => $this->configService->getAppValue(ConfigService::CIRCLES_ALLOW_FEDERATED_CIRCLES),
|
||||
'disabled_notification_for_seen_users' => $this->configService->getAppValue(ConfigService::CIRCLES_DISABLE_NOTIFICATION_FOR_SEEN_USERS),
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
|
|
|
@ -48,6 +48,9 @@ class SettingsController extends Controller {
|
|||
),
|
||||
'allowFederatedCircles' => $this->configService->getAppValue(
|
||||
ConfigService::CIRCLES_ALLOW_FEDERATED_CIRCLES
|
||||
),
|
||||
'disableNotificationForSeenUsers' => $this->configService->getAppValue(
|
||||
ConfigService::CIRCLES_DISABLE_NOTIFICATION_FOR_SEEN_USERS
|
||||
)
|
||||
];
|
||||
|
||||
|
@ -55,7 +58,7 @@ class SettingsController extends Controller {
|
|||
}
|
||||
|
||||
|
||||
public function setSettings($members_limit, $allow_linked_groups, $allow_federated_circles) {
|
||||
public function setSettings($members_limit, $allow_linked_groups, $allow_federated_circles, $disable_notification_for_seen_users) {
|
||||
$this->configService->setAppValue(
|
||||
ConfigService::CIRCLES_MEMBERS_LIMIT, $members_limit
|
||||
);
|
||||
|
@ -65,6 +68,9 @@ class SettingsController extends Controller {
|
|||
$this->configService->setAppValue(
|
||||
ConfigService::CIRCLES_ALLOW_FEDERATED_CIRCLES, $allow_federated_circles
|
||||
);
|
||||
$this->configService->setAppValue(
|
||||
ConfigService::CIRCLES_DISABLE_NOTIFICATION_FOR_SEEN_USERS, $disable_notification_for_seen_users
|
||||
);
|
||||
|
||||
return $this->getSettings();
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ class ConfigService {
|
|||
const CIRCLES_ALLOW_LINKED_GROUPS = 'allow_linked_groups';
|
||||
const CIRCLES_ALLOW_NON_SSL_LINKS = 'allow_non_ssl_links';
|
||||
const CIRCLES_NON_SSL_LOCAL = 'local_is_non_ssl';
|
||||
const CIRCLES_DISABLE_NOTIFICATION_FOR_SEEN_USERS = 'disable_notification_for_seen_users';
|
||||
|
||||
const CIRCLES_TEST_ASYNC_LOCK = 'test_async_lock';
|
||||
const CIRCLES_TEST_ASYNC_INIT = 'test_async_init';
|
||||
|
@ -55,7 +56,8 @@ class ConfigService {
|
|||
self::CIRCLES_ALLOW_LINKED_GROUPS => '0',
|
||||
self::CIRCLES_ALLOW_FEDERATED_CIRCLES => '0',
|
||||
self::CIRCLES_ALLOW_NON_SSL_LINKS => '0',
|
||||
self::CIRCLES_NON_SSL_LOCAL => '0'
|
||||
self::CIRCLES_NON_SSL_LOCAL => '0',
|
||||
self::CIRCLES_DISABLE_NOTIFICATION_FOR_SEEN_USERS => '0',
|
||||
];
|
||||
|
||||
/** @var string */
|
||||
|
@ -87,6 +89,9 @@ class ConfigService {
|
|||
|
||||
/** @var int */
|
||||
private $localNonSSL = -1;
|
||||
|
||||
/** @var int */
|
||||
private $disabledNotificationForSeenUsers = -1;
|
||||
|
||||
/**
|
||||
* ConfigService constructor.
|
||||
|
@ -181,6 +186,17 @@ class ConfigService {
|
|||
return ($this->allowedNonSSLLinks === 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDisabledNotificationForSeenUsers() {
|
||||
if ($this->disabledNotificationForSeenUsers === -1) {
|
||||
$this->disabledNotificationForSeenUsers =
|
||||
(int)$this->getAppValue(self::CIRCLES_DISABLE_NOTIFICATION_FOR_SEEN_USERS);
|
||||
}
|
||||
|
||||
return ($this->disabledNotificationForSeenUsers === 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $remote
|
||||
|
|
|
@ -100,22 +100,29 @@ class EventsService {
|
|||
* @param Circle $circle
|
||||
*/
|
||||
public function onCircleCreation(Circle $circle) {
|
||||
if ($circle->getType() !== Circle::CIRCLES_PUBLIC
|
||||
&& $circle->getType() !== Circle::CIRCLES_CLOSED
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$event = $this->generateEvent('circles_as_member');
|
||||
$event->setSubject('circle_create', ['circle' => json_encode($circle)]);
|
||||
|
||||
$this->userManager->callForSeenUsers(
|
||||
function($user) use ($event) {
|
||||
/** @var IUser $user */
|
||||
$this->publishEvent($event, [$user]);
|
||||
}
|
||||
);
|
||||
if ($circle->getType() !== Circle::CIRCLES_PUBLIC
|
||||
&& $circle->getType() !== Circle::CIRCLES_CLOSED
|
||||
) {
|
||||
$this->publishEvent($event, [\OC::$server->getUserSession()->getUser()]);
|
||||
$this->dispatch('\OCA\Circles::onCircleCreation', ['circle' => $circle]);
|
||||
return;
|
||||
}
|
||||
|
||||
$disableNotificationForSeenUsers = \OC::$server->getAppConfig()->getValue('circles', 'disable_notification_for_seen_users', false);
|
||||
if ($disableNotificationForSeenUsers) {
|
||||
$this->publishEvent($event, [\OC::$server->getUserSession()->getUser()]);
|
||||
} else {
|
||||
$this->userManager->callForSeenUsers(
|
||||
function($user) use ($event) {
|
||||
/** @var IUser $user */
|
||||
$this->publishEvent($event, [$user]);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$this->dispatch('\OCA\Circles::onCircleCreation', ['circle' => $circle]);
|
||||
}
|
||||
|
||||
|
|
|
@ -407,6 +407,11 @@ style(Application::APP_NAME, 'navigation');
|
|||
</td>
|
||||
<td><input type="checkbox" value="1" id="settings-link-auto"></td>
|
||||
</tr>
|
||||
<tr id="settings-entry-notification">
|
||||
<td class="left"><?php p($l->t('Disable notification for seen users.')); ?>
|
||||
</td>
|
||||
<td><input type="checkbox" value="0" id="settings-notification"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center;">
|
||||
|
|
|
@ -25,4 +25,9 @@ style(Application::APP_NAME, 'admin');
|
|||
<label for="allow_federated_circles"><?php p($l->t('Allow federated circles')); ?></label>
|
||||
<em><?php p($l->t('Circles from different Nextclouds can be linked together.')); ?></em>
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" value="0" id="disable_notification_for_seen_users" class="checkbox"/>
|
||||
<label for="disable_notification_for_seen_users"><?php p($l->t('Disable notification for seen users.')); ?></label>
|
||||
<em><?php p($l->t('Disable notification for seen users.')); ?></em>
|
||||
</p>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue