(s: SendView)
| 204 | } |
| 205 | |
| 206 | async delete(s: SendView): Promise<boolean> { |
| 207 | if (this.actionPromise != null) { |
| 208 | return false; |
| 209 | } |
| 210 | |
| 211 | const confirmed = await this.dialogService.openSimpleDialog({ |
| 212 | title: { key: "deleteSend" }, |
| 213 | content: { key: "deleteSendConfirmation" }, |
| 214 | type: "warning", |
| 215 | }); |
| 216 | |
| 217 | if (!confirmed) { |
| 218 | return false; |
| 219 | } |
| 220 | |
| 221 | try { |
| 222 | this.actionPromise = this.sendApiService.delete(s.id); |
| 223 | await this.actionPromise; |
| 224 | |
| 225 | if (this.onSuccessfulDelete != null) { |
| 226 | // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. |
| 227 | // eslint-disable-next-line @typescript-eslint/no-floating-promises |
| 228 | this.onSuccessfulDelete(); |
| 229 | } else { |
| 230 | // Default actions |
| 231 | this.toastService.showToast({ |
| 232 | variant: "success", |
| 233 | title: null, |
| 234 | message: this.i18nService.t("deletedSend"), |
| 235 | }); |
| 236 | await this.refresh(); |
| 237 | } |
| 238 | } catch (e) { |
| 239 | this.logService.error(e); |
| 240 | } |
| 241 | this.actionPromise = null; |
| 242 | return true; |
| 243 | } |
| 244 | |
| 245 | async copy(s: SendView) { |
| 246 | const env = await firstValueFrom(this.environmentService.environment$); |
no test coverage detected