1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-21 21:30:08 +00:00

Revert usage of the optional chaining operator (?.)

This commit is contained in:
Maximilian Mader 2020-11-01 17:19:13 +01:00
parent f8dafa2583
commit 2559ae7935
Signed by: Max
GPG Key ID: F71D56A3151C4FB3

View File

@ -155,18 +155,20 @@ define([ 'WoltLabSuite/Core/Language'
* @see WoltLabSuite/Core/Upload#_success * @see WoltLabSuite/Core/Upload#_success
*/ */
_success(uploadId, data, responseText, xhr, requestOptions) { _success(uploadId, data, responseText, xhr, requestOptions) {
if (data.returnValues?.errors?.[0]) { if (data.returnValues.errors && data.returnValues.errors[0]) {
const error = data.returnValues.errors[0] const error = data.returnValues.errors[0]
elInnerError(this._button, Language.get(`wcf.attachment.upload.error.${error.errorType}`, { elInnerError(this._button, Language.get(`wcf.attachment.upload.error.${error.errorType}`, {
filename: error.filename filename: error.filename
})) }))
return
} }
else { else {
elInnerError(this._button, '') elInnerError(this._button, '')
} }
if (data.returnValues?.attachments?.[uploadId]) { if (data.returnValues.attachments && data.returnValues.attachments[uploadId]) {
this._removeButton() this._removeButton()
elHide(this.uploadDescription) elHide(this.uploadDescription)
@ -198,6 +200,10 @@ define([ 'WoltLabSuite/Core/Language'
this.createButtonGroup(uploadId, attachment.attachmentID, this.tmpHash) this.createButtonGroup(uploadId, attachment.attachmentID, this.tmpHash)
} }
else {
console.error("Received neither an error nor an attachment response")
console.error(data.returnValues)
}
} }
} }
UiAttachmentUpload.DEPENDENCIES = DEPENDENCIES UiAttachmentUpload.DEPENDENCIES = DEPENDENCIES