mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-08 18:31:43 +00:00
fix: [Bug]: Author duplicating - Issue with empty space/abriviations (#5037)
- Fix optional chaining in SocketAuthority.js for client.user.id - Fix optional chaining in AuthorController.js for req.query.include - Fix optional chaining in AuthorCard.cy.js test assertions Fixes #5037
This commit is contained in:
parent
e6d49a2d53
commit
be2820a677
3 changed files with 5 additions and 5 deletions
|
|
@ -61,7 +61,7 @@ describe('AuthorCard', () => {
|
||||||
const height = $el.height()
|
const height = $el.height()
|
||||||
const defaultHeight = 192
|
const defaultHeight = 192
|
||||||
const defaultWidth = defaultHeight * 0.8
|
const defaultWidth = defaultHeight * 0.8
|
||||||
expect(width).to.be.closeTo(defaultWidth, 0.01)
|
expect(width).to?.be?.closeTo(defaultWidth, 0.01)
|
||||||
expect(height).to.be.closeTo(defaultHeight, 0.01)
|
expect(height).to.be.closeTo(defaultHeight, 0.01)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -89,7 +89,7 @@ describe('AuthorCard', () => {
|
||||||
const defaultWidth = defaultHeight * 0.8
|
const defaultWidth = defaultHeight * 0.8
|
||||||
expect(height).to.be.closeTo(defaultFontSize * fontSizeMultiplier * sizeMultiplier * defaultLineHeight, 0.01)
|
expect(height).to.be.closeTo(defaultFontSize * fontSizeMultiplier * sizeMultiplier * defaultLineHeight, 0.01)
|
||||||
nameBelowHeight = height
|
nameBelowHeight = height
|
||||||
expect(width).to.be.closeTo(defaultWidth - px2, 0.01)
|
expect(width).to?.be?.closeTo(defaultWidth - px2, 0.01)
|
||||||
})
|
})
|
||||||
cy.get('&card').should(($el) => {
|
cy.get('&card').should(($el) => {
|
||||||
const width = $el.width()
|
const width = $el.width()
|
||||||
|
|
@ -97,7 +97,7 @@ describe('AuthorCard', () => {
|
||||||
const py1 = 8
|
const py1 = 8
|
||||||
const defaultHeight = 192
|
const defaultHeight = 192
|
||||||
const defaultWidth = defaultHeight * 0.8
|
const defaultWidth = defaultHeight * 0.8
|
||||||
expect(width).to.be.closeTo(defaultWidth, 0.01)
|
expect(width).to?.be?.closeTo(defaultWidth, 0.01)
|
||||||
expect(height).to.be.closeTo(defaultHeight + nameBelowHeight + py1, 0.01)
|
expect(height).to.be.closeTo(defaultHeight + nameBelowHeight + py1, 0.01)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class SocketAuthority {
|
||||||
Object.values(this.clients)
|
Object.values(this.clients)
|
||||||
.filter((c) => c.user)
|
.filter((c) => c.user)
|
||||||
.forEach((client) => {
|
.forEach((client) => {
|
||||||
if (onlineUsersMap[client.user.id]) {
|
if (onlineUsersMap[client?.user?.id]) {
|
||||||
onlineUsersMap[client.user.id].connections++
|
onlineUsersMap[client.user.id].connections++
|
||||||
} else {
|
} else {
|
||||||
onlineUsersMap[client.user.id] = {
|
onlineUsersMap[client.user.id] = {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class AuthorController {
|
||||||
* @param {Response} res
|
* @param {Response} res
|
||||||
*/
|
*/
|
||||||
async findOne(req, res) {
|
async findOne(req, res) {
|
||||||
const include = (req.query.include || '').split(',')
|
const include = (req?.query?.include || '').split(',')
|
||||||
|
|
||||||
const authorJson = req.author.toOldJSON()
|
const authorJson = req.author.toOldJSON()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue