1
0
mirror of https://github.com/nextcloud/ocsms.git synced 2026-08-11 16:32:55 +00:00

Permit to disable notifications from app settings directly

This fixes issue #89
This commit is contained in:
Loic Blot
2016-01-30 23:23:27 +01:00
parent 4827856fe2
commit 74928c8e64
5 changed files with 88 additions and 36 deletions
+26 -14
View File
@@ -34,6 +34,22 @@ class SettingsController extends Controller {
$this->configMapper = $cfgMapper;
}
/**
* @NoAdminRequired
*/
function getSettings() {
$country = $this->configMapper->getKey("country");
if ($country === false) {
return new JSONResponse(array("status" => false));
}
return new JSONResponse(array("status" => true,
"country" => $country,
"message_limit" => $this->configMapper->getMessageLimit(),
"notification_state" => $this->configMapper->getNotificationState()
));
}
/**
* @NoAdminRequired
*/
@@ -45,20 +61,6 @@ class SettingsController extends Controller {
return new JSONResponse(array("status" => true, "msg" => "OK"));
}
/**
* @NoAdminRequired
*/
function getSettings() {
$country = $this->configMapper->getKey("country");
if ($country === false) {
return new JSONResponse(array("status" => false));
}
$message_limit = $this->configMapper->getKey("message_limit");
return new JSONResponse(array("status" => true,
"country" => $country,
"message_limit" => $message_limit));
}
/**
* @NoAdminRequired
*/
@@ -67,4 +69,14 @@ class SettingsController extends Controller {
return new JSONResponse(array("status" => true, "msg" => "OK"));
}
/**
* @NoAdminRequired
*/
function setNotificationState($notification) {
if (!is_numeric($notification) || $notification < 0 || $notification > 2) {
return new JSONResponse(array("status" => false, "msg" => "Invalid notification state"));
}
$this->configMapper->set("notification_state", $notification);
return new JSONResponse(array("status" => true, "msg" => "OK"));
}
}