More webapp changes+fixes
This commit is contained in:
@@ -159,6 +159,11 @@ export class SubscriptionListComponent implements OnInit {
|
||||
return sub.channel_owner_user_id === userId;
|
||||
}
|
||||
|
||||
isOwnSubscription(sub: Subscription): boolean {
|
||||
const userId = this.authService.getUserId();
|
||||
return sub.subscriber_user_id === userId && sub.channel_owner_user_id === userId;
|
||||
}
|
||||
|
||||
viewSubscription(sub: Subscription): void {
|
||||
this.router.navigate(['/subscriptions', sub.subscription_id]);
|
||||
}
|
||||
@@ -200,6 +205,30 @@ export class SubscriptionListComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
activateSubscription(sub: Subscription): void {
|
||||
const userId = this.authService.getUserId();
|
||||
if (!userId) return;
|
||||
|
||||
this.apiService.confirmSubscription(userId, sub.subscription_id, { active: true }).subscribe({
|
||||
next: () => {
|
||||
this.notification.success('Subscription activated');
|
||||
this.loadSubscriptions();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
deactivateSubscription(sub: Subscription): void {
|
||||
const userId = this.authService.getUserId();
|
||||
if (!userId) return;
|
||||
|
||||
this.apiService.confirmSubscription(userId, sub.subscription_id, { active: false }).subscribe({
|
||||
next: () => {
|
||||
this.notification.success('Subscription deactivated');
|
||||
this.loadSubscriptions();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Create subscription
|
||||
openCreateModal(): void {
|
||||
this.newChannelOwner = '';
|
||||
|
||||
Reference in New Issue
Block a user