Commit 9590b251 authored by Emiliano Balbuena's avatar Emiliano Balbuena

(refactor): Save settings last; custom assets flag field

1 merge request!596WIP: Pro logo and background upload
Pipeline #89348968 failed with stages
in 51 minutes and 42 seconds
......@@ -21,7 +21,6 @@ context('Pro Settings', () => {
43: '#tile_ratio_4\:3', // 4:3
11: '#tile_ratio_1\:1' , // 1:1
},
logoGuid: '#logo_guid',
}
const hashtags = {
......
......@@ -85,7 +85,6 @@ export interface MindsUser {
pro_published?: boolean;
pro_settings?: {
logo_image: string;
logo_guid: string;
tag_list?: Tag[];
background_image: string;
title: string;
......@@ -97,6 +96,8 @@ export interface MindsUser {
featured_content?: Array<string>;
tile_ratio?: string;
styles?: { [key: string]: string };
has_custom_logo?: boolean;
has_custom_background?: boolean;
};
mode: ChannelMode;
}
......
<div class="m-pro__channel">
<ng-container *ngIf="channel">
<div class="m-proChannel__topbar">
<ng-container *ngIf="!channel.pro_settings.logo_guid; else customLogo">
<ng-container
*ngIf="!channel.pro_settings.has_custom_logo; else customLogo"
>
<minds-avatar
[object]="channel"
[routerLink]="homeRouterLink"
......
......@@ -118,7 +118,6 @@ export class ProSettingsComponent implements OnInit, OnDestroy {
try {
const { logo, background, ...settings } = this.settings;
await this.service.set(settings, this.user);
if (logo) {
await this.service.upload('logo', logo, this.user);
......@@ -131,7 +130,7 @@ export class ProSettingsComponent implements OnInit, OnDestroy {
}
}
this.settings.logo = null;
settings.has_custom_logo = true;
}
if (background) {
......@@ -145,8 +144,12 @@ export class ProSettingsComponent implements OnInit, OnDestroy {
}
}
this.settings.background = null;
settings.has_custom_background = true;
}
this.settings = settings;
await this.service.set(this.settings, this.user);
} catch (e) {
this.error = e.message;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment