...
 
Commits (3)
......@@ -264,7 +264,7 @@
</div>
<a
*ngIf="showBecomeProButton"
*ngIf="false && showBecomeProButton"
class="m-btn m-link-btn m-btn--with-icon m-btn--slim m-btn--action"
routerLink="/pro"
>
......@@ -285,7 +285,18 @@
*ngIf="session.getLoggedInUser().guid == user.guid"
[object]="user"
></minds-button-boost>
<m-channel--badges [user]="user"></m-channel--badges>
<a *ngIf="session.getLoggedInUser()?.is_admin" (click)="proAdminToggle()">
<m-tooltip
icon="business_center"
[iconClass]="user.pro ? 'selected' : ''"
i18n
>
Pro
</m-tooltip>
</a>
</div>
</div>
......
......@@ -160,6 +160,26 @@ export class ChannelSidebar {
.present();
}
async proAdminToggle() {
const value = !this.user.pro;
const method = value ? 'put' : 'delete';
this.user.pro = value;
try {
const response = (await this.client[method](
`api/v2/admin/pro/${this.user.guid}`
)) as any;
if (!response || response.status !== 'success') {
throw new Error('Invalid server response');
}
} catch (e) {
console.error(e);
this.user.pro = !value;
}
}
get showBecomeProButton() {
const isOwner =
this.session.isLoggedIn() &&
......
......@@ -129,7 +129,9 @@
<a
class="m-page--sidebar--navigation--item"
routerLink="/pro"
*ngIf="session.isLoggedIn() && !session.getLoggedInUser().pro"
*ngIf="
false && (session.isLoggedIn() && !session.getLoggedInUser().pro)
"
>
<i class="material-icons">business_center</i>
<span>Become Pro</span>
......
<div *ngIf="isLoggedIn">
<ng-container *ngIf="!inProgress; else inProgressSpinner">
<button
[hidden]="true"
*ngIf="!active"
class="mdl-button mdl-button--colored mdl-color--green"
[disabled]="inProgress || criticalError"
......
m-pro--subscription {
.m-pro-subscription--error {
display: block;
font-weight: bold;
color: #fff;
margin: 8px 0 0 5px;
}
}