mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-11 03:41:42 +00:00
handle name duplicates and remove helper func
This commit is contained in:
parent
9ccdf305fe
commit
b9772a024c
2 changed files with 22 additions and 18 deletions
|
|
@ -174,20 +174,5 @@ class EmailSettings {
|
|||
getEReaderDevice(deviceName) {
|
||||
return this.ereaderDevices.find((d) => d.name === deviceName)
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the ereader devices that belong to a specific user
|
||||
*
|
||||
* @param {import('../../models/User')} user
|
||||
* @param {EreaderDeviceObject[]} userEReaderDevices
|
||||
* @returns {boolean}
|
||||
*/
|
||||
updateUserEReaderDevices(user, userEReaderDevices) {
|
||||
// Filter to get all devices the user can't access separate
|
||||
// then merge with the updated user devices
|
||||
const otherDevices = this.ereaderDevices.filter((device) => !this.checkUserCanAccessDevice(device, user))
|
||||
const ereaderDevices = otherDevices.concat(userEReaderDevices)
|
||||
return this.update({ ereaderDevices })
|
||||
}
|
||||
}
|
||||
module.exports = EmailSettings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue