Finished implementing notification settings for sound and strangers
This commit is contained in:
parent
4cd2302bc9
commit
ae8d1fc5ea
4 changed files with 55 additions and 8 deletions
|
@ -161,13 +161,13 @@
|
|||
</div>
|
||||
<div class="columns notificationSetting">
|
||||
<div class="column">
|
||||
Only show notifications for friends
|
||||
Notifications for stranger's messages
|
||||
</div>
|
||||
<div class="column is-2">
|
||||
<div class="field">
|
||||
<input id="friendsOnlyNotifications" type="checkbox"
|
||||
class="switch is-rounded">
|
||||
<label for="friendsOnlyNotifications"></label>
|
||||
<input id="strangersNotification" type="checkbox"
|
||||
class="switch is-rounded" checked>
|
||||
<label for="strangersNotification"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -177,9 +177,9 @@
|
|||
</div>
|
||||
<div class="column is-2">
|
||||
<div class="field">
|
||||
<input id="audibleNotificationSetting" type="checkbox"
|
||||
class="switch is-rounded">
|
||||
<label for="audibleNotificationSetting"></label>
|
||||
<input id="notificationSound" type="checkbox"
|
||||
class="switch is-rounded" checked>
|
||||
<label for="notificationSound"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -17,7 +17,13 @@ fetch('/config/get/mail', {
|
|||
if (mailSettings.notificationSetting === false){
|
||||
document.getElementById('notificationSetting').checked = false
|
||||
}
|
||||
if (mailSettings.notificationSound === false){
|
||||
document.getElementById('notificationSound').checked = false
|
||||
}
|
||||
if (typeof mailSettings.signature != undefined && mailSettings.signature != null && mailSettings.signature != ""){
|
||||
document.getElementById('mailSignatureSetting').value = mailSettings.signature
|
||||
}
|
||||
if (mailSettings.strangersNotification == false){
|
||||
document.getElementById('strangersNotification').checked = false
|
||||
}
|
||||
})
|
|
@ -17,6 +17,8 @@
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
var notificationSetting = document.getElementById('notificationSetting')
|
||||
var friendOnlyNotification = document.getElementById('strangersNotification')
|
||||
var notificationSound = document.getElementById('notificationSound')
|
||||
var sigSetting = document.getElementById('mailSignatureSetting')
|
||||
|
||||
document.getElementById('forwardSecrecySetting').onchange = function(e){
|
||||
|
@ -37,6 +39,40 @@ document.getElementById('forwardSecrecySetting').onchange = function(e){
|
|||
})
|
||||
}
|
||||
|
||||
notificationSound.onchange = function(e){
|
||||
var postData = JSON.stringify({"notificationSound": e.target.checked})
|
||||
fetch('/config/set/mail', {
|
||||
method: 'POST',
|
||||
body: postData,
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"token": webpass
|
||||
}})
|
||||
.then(function(data) {
|
||||
mailSettings['notificationSound'] = notificationSound.checked
|
||||
PNotify.success({
|
||||
text: 'Successfully notification sound'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
friendOnlyNotification.onchange = function(e){
|
||||
var postData = JSON.stringify({"strangersNotification": e.target.checked})
|
||||
fetch('/config/set/mail', {
|
||||
method: 'POST',
|
||||
body: postData,
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"token": webpass
|
||||
}})
|
||||
.then(function(data) {
|
||||
mailSettings['strangersNotification'] = friendOnlyNotification.checked
|
||||
PNotify.success({
|
||||
text: 'Successfully toggled notifications from strangers'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
notificationSetting.onchange = function(e){
|
||||
var notificationSettings = document.getElementsByClassName('notificationSetting')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue