fix notif sounds for general users being pulled from ones for specific users

This commit is contained in:
notfire 2025-02-11 09:24:39 -05:00
parent 7c4cc56ff4
commit 0f633b98b0
Signed by: notfire
GPG key ID: 3AFDACAAB4E56B16

View file

@ -140,9 +140,11 @@ export const prepareNotificationObject = (notification, i18n, store) => {
var soundVol
var soundList = store.getters.mergedConfig.soundOnNotifCustom.split("\n")
var randomSound
var indexesToRemove = []
soundList.forEach(sound => {
// if there's more args, assume specific user tied to sound
if (sound.split(";").length > 2) {
indexesToRemove.push(soundList.indexOf(sound))
var user = [sound.split(";")[2]]
if (user == notification.from_profile.id) {
randomSound = sound.split(";")[0]
@ -151,6 +153,10 @@ export const prepareNotificationObject = (notification, i18n, store) => {
}
}
});
// ensure we remove the sounds with > 2 args
indexesToRemove.forEach(index => {
soundList.splice(index, 1)
})
if (fallback) {
randomSound = soundList[Math.floor(Math.random() * soundList.length)]
soundVol = (randomSound.split(";").length > 1 ? randomSound.split(";")[1] : store.getters.mergedConfig.soundOnNotifVolume)