🪻 distributed transcription service thistle.dunkirk.sh
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bug: fix archiving

+16 -6
+10 -1
src/components/admin-classes.ts
··· 497 497 498 498 private async handleToggleArchive(classId: string) { 499 499 try { 500 + // Find the class to toggle its archived state 501 + const classToToggle = this.classes.find(c => c.id === classId); 502 + if (!classToToggle) return; 503 + 500 504 const response = await fetch(`/api/classes/${classId}/archive`, { 501 505 method: "PUT", 506 + headers: { "Content-Type": "application/json" }, 507 + body: JSON.stringify({ archived: !classToToggle.archived }), 502 508 }); 503 509 504 510 if (!response.ok) { 505 511 throw new Error("Failed to update class"); 506 512 } 507 513 508 - await this.loadData(); 514 + // Update local state instead of reloading 515 + this.classes = this.classes.map(c => 516 + c.id === classId ? { ...c, archived: !c.archived } : c 517 + ); 509 518 } catch { 510 519 this.error = "Failed to update class. Please try again."; 511 520 }
+6 -5
src/components/admin-users.ts
··· 349 349 timeout: number | null; 350 350 } | null = null; 351 351 352 - private handleDeleteClick(userId: number, email: string, event: Event) { 352 + private handleDeleteClick(userId: number, event: Event) { 353 353 event.stopPropagation(); 354 354 355 355 // If this is a different item or timeout expired, reset ··· 383 383 // Third click - actually delete 384 384 if (newClicks === 3) { 385 385 this.deleteState = null; 386 - this.performDeleteUser(userId, email); 386 + this.performDeleteUser(userId); 387 387 return; 388 388 } 389 389 ··· 395 395 this.deleteState = { id: userId, type: "user", clicks: newClicks, timeout }; 396 396 } 397 397 398 - private async performDeleteUser(userId: number, email: string) { 398 + private async performDeleteUser(userId: number) { 399 399 try { 400 400 const response = await fetch(`/api/admin/users/${userId}`, { 401 401 method: "DELETE", ··· 405 405 throw new Error("Failed to delete user"); 406 406 } 407 407 408 - await this.loadUsers(); 408 + // Remove user from local array instead of reloading 409 + this.users = this.users.filter(u => u.id !== userId); 409 410 this.dispatchEvent(new CustomEvent("user-deleted")); 410 411 } catch (error) { 411 412 console.error("Failed to delete user:", error); ··· 633 634 > 634 635 ${this.revokingSubscriptions.has(u.id) ? "Revoking..." : this.getDeleteButtonText(u.id, "revoke")} 635 636 </button> 636 - <button class="delete-btn" @click=${(e: Event) => this.handleDeleteClick(u.id, u.email, e)}> 637 + <button class="delete-btn" @click=${(e: Event) => this.handleDeleteClick(u.id, e)}> 637 638 ${this.getDeleteButtonText(u.id, "user")} 638 639 </button> 639 640 </div>