More webapp changes+fixes
All checks were successful
Build Docker and Deploy / Build Docker Container (push) Successful in 1m0s
Build Docker and Deploy / Run Unit-Tests (push) Successful in 9m18s
Build Docker and Deploy / Deploy to Server (push) Successful in 22s

This commit is contained in:
2025-12-07 04:21:11 +01:00
parent 2b7950f5dc
commit c81143ecdc
17 changed files with 297 additions and 20 deletions

View File

@@ -390,4 +390,33 @@ export class ChannelDetailComponent implements OnInit {
}
});
}
isUserSubscribed(): boolean {
return this.channel()?.subscription !== null;
}
toggleSelfSubscription(): void {
const channel = this.channel();
const userId = this.authService.getUserId();
if (!channel || !userId) return;
if (this.isUserSubscribed()) {
// Unsubscribe
const subscriptionId = channel.subscription!.subscription_id;
this.apiService.deleteSubscription(userId, subscriptionId).subscribe({
next: () => {
this.notification.success('Unsubscribed from channel');
this.loadChannel(channel.channel_id);
}
});
} else {
// Subscribe
this.apiService.createSubscription(userId, { channel_id: channel.channel_id }).subscribe({
next: () => {
this.notification.success('Subscribed to channel');
this.loadChannel(channel.channel_id);
}
});
}
}
}