fixing the version check on the bookmarks feature

This commit is contained in:
Rob Petti 2022-11-17 16:08:13 -07:00
parent 33a61f7347
commit 83f52391ae
2 changed files with 11 additions and 11 deletions

View File

@ -59,11 +59,11 @@ export class ManageAccountComponent extends BrowseBase {
private readonly toolsService: ToolsService, private readonly toolsService: ToolsService,
private readonly mastodonService: MastodonWrapperService, private readonly mastodonService: MastodonWrapperService,
private readonly notificationService: NotificationService, private readonly notificationService: NotificationService,
private readonly userNotificationService: UserNotificationService) { private readonly userNotificationService: UserNotificationService) {
super(); super();
} }
ngOnInit() { ngOnInit() {
} }
ngOnDestroy(): void { ngOnDestroy(): void {
@ -73,7 +73,7 @@ export class ManageAccountComponent extends BrowseBase {
private checkIfBookmarksAreAvailable() { private checkIfBookmarksAreAvailable() {
this.toolsService.getInstanceInfo(this.account.info) this.toolsService.getInstanceInfo(this.account.info)
.then((instance: InstanceInfo) => { .then((instance: InstanceInfo) => {
if (instance.major >= 3 && instance.minor >= 1) { if (instance.major == 3 && instance.minor >= 1 || instance.major > 3) {
this.isBookmarksAvailable = true; this.isBookmarksAvailable = true;
} else { } else {
this.isBookmarksAvailable = false; this.isBookmarksAvailable = false;
@ -137,7 +137,7 @@ export class ManageAccountComponent extends BrowseBase {
loadSubPanel(subpanel: 'account' | 'notifications' | 'mentions' | 'dm' | 'favorites' | 'bookmarks'): boolean { loadSubPanel(subpanel: 'account' | 'notifications' | 'mentions' | 'dm' | 'favorites' | 'bookmarks'): boolean {
if(this.subPanel === subpanel){ if(this.subPanel === subpanel){
switch(subpanel){ switch(subpanel){
case 'bookmarks': case 'bookmarks':
this.bookmarksComp.applyGoToTop(); this.bookmarksComp.applyGoToTop();
break; break;
case 'notifications': case 'notifications':
@ -151,12 +151,12 @@ export class ManageAccountComponent extends BrowseBase {
break; break;
case 'favorites': case 'favorites':
this.favoritesComp.applyGoToTop(); this.favoritesComp.applyGoToTop();
break; break;
} }
} }
this.subPanel = subpanel; this.subPanel = subpanel;
return false; return false;
} }

View File

@ -190,7 +190,7 @@ export class ActionBarComponent implements OnInit, OnDestroy {
this.boostPromise = Promise.resolve(true); this.boostPromise = Promise.resolve(true);
} }
const account = this.toolsService.getSelectedAccounts()[0]; const account = this.toolsService.getSelectedAccounts()[0];
this.boostPromise = this.boostPromise this.boostPromise = this.boostPromise
.then(() => { .then(() => {
this.boostIsLoading = true; this.boostIsLoading = true;
@ -231,11 +231,11 @@ export class ActionBarComponent implements OnInit, OnDestroy {
} }
private favoritePromise: Promise<any>; private favoritePromise: Promise<any>;
favorite(): boolean { favorite(): boolean {
if (!this.favoritePromise) { if (!this.favoritePromise) {
this.favoritePromise = Promise.resolve(true); this.favoritePromise = Promise.resolve(true);
} }
const account = this.toolsService.getSelectedAccounts()[0]; const account = this.toolsService.getSelectedAccounts()[0];
this.favoritePromise = this.favoritePromise this.favoritePromise = this.favoritePromise
.then(() => { .then(() => {
@ -282,7 +282,7 @@ export class ActionBarComponent implements OnInit, OnDestroy {
.then(() => { .then(() => {
this.bookmarkingIsLoading = true; this.bookmarkingIsLoading = true;
return this.toolsService.getStatusUsableByAccount(account, this.statusWrapper); return this.toolsService.getStatusUsableByAccount(account, this.statusWrapper);
}) })
.then((status: Status) => { .then((status: Status) => {
if (this.isBookmarked && status.bookmarked) { if (this.isBookmarked && status.bookmarked) {
return this.mastodonService.unbookmark(account, status); return this.mastodonService.unbookmark(account, status);
@ -344,7 +344,7 @@ export class ActionBarComponent implements OnInit, OnDestroy {
private checkIfBookmarksAreAvailable(account: AccountInfo) { private checkIfBookmarksAreAvailable(account: AccountInfo) {
this.toolsService.getInstanceInfo(account) this.toolsService.getInstanceInfo(account)
.then((instance: InstanceInfo) => { .then((instance: InstanceInfo) => {
if (instance.major >= 3 && instance.minor >= 1) { if (instance.major == 3 && instance.minor >= 1 || instance.major > 3) {
this.isBookmarksAvailable = true; this.isBookmarksAvailable = true;
} else { } else {
this.isBookmarksAvailable = false; this.isBookmarksAvailable = false;