More webapp changes+fixes
This commit is contained in:
@@ -118,6 +118,13 @@ export class SubscriptionDetailComponent implements OnInit {
|
||||
return sub.channel_owner_user_id === userId;
|
||||
}
|
||||
|
||||
isOwnSubscription(): boolean {
|
||||
const sub = this.subscription();
|
||||
if (!sub) return false;
|
||||
const userId = this.authService.getUserId();
|
||||
return sub.subscriber_user_id === userId && sub.channel_owner_user_id === userId;
|
||||
}
|
||||
|
||||
getStatusInfo(): { label: string; color: string } {
|
||||
const sub = this.subscription();
|
||||
if (!sub) return { label: 'Unknown', color: 'default' };
|
||||
@@ -153,6 +160,19 @@ export class SubscriptionDetailComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
activateSubscription(): void {
|
||||
const sub = this.subscription();
|
||||
const userId = this.authService.getUserId();
|
||||
if (!sub || !userId) return;
|
||||
|
||||
this.apiService.confirmSubscription(userId, sub.subscription_id, { active: true }).subscribe({
|
||||
next: (updated) => {
|
||||
this.subscription.set(updated);
|
||||
this.notification.success('Subscription activated');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
deactivateSubscription(): void {
|
||||
const sub = this.subscription();
|
||||
const userId = this.authService.getUserId();
|
||||
|
||||
Reference in New Issue
Block a user