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:
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user