limit bookmarks to mastodon > 3.1
This commit is contained in:
parent
9aefdbe870
commit
0aed10cbff
|
@ -20,11 +20,11 @@
|
|||
</a>
|
||||
<fa-icon *ngIf="isLocked" class="action-bar__lock" title="Account can't access this post" [icon]="faLock"></fa-icon>
|
||||
|
||||
<a *ngIf="!isLocked" href class="action-bar__link action-bar__link--bookmark" title="Bookmark"
|
||||
<a *ngIf="isBookmarksAvailable && !isLocked" href class="action-bar__link action-bar__link--bookmark" title="Bookmark"
|
||||
[class.bookmarked]="isBookmarked" [class.favoriting]="bookmarkingIsLoading" (click)="bookmark()">
|
||||
<fa-icon [icon]="faBookmark"></fa-icon>
|
||||
</a>
|
||||
<fa-icon *ngIf="isLocked" class="action-bar__lock" title="Account can't access this post" [icon]="faLock"></fa-icon>
|
||||
<fa-icon *ngIf="isBookmarksAvailable && isLocked" class="action-bar__lock" title="Account can't access this post" [icon]="faLock"></fa-icon>
|
||||
|
||||
<a href class="action-bar__link action-bar__link--cw" title="show content" (click)="showContent()"
|
||||
*ngIf="isContentWarningActive">
|
||||
|
|
|
@ -8,7 +8,7 @@ import { faWindowClose as faWindowCloseRegular } from "@fortawesome/free-regular
|
|||
import { MastodonWrapperService } from '../../../../services/mastodon-wrapper.service';
|
||||
import { AccountInfo } from '../../../../states/accounts.state';
|
||||
import { Status, Account, Results } from '../../../../services/models/mastodon.interfaces';
|
||||
import { ToolsService, OpenThreadEvent } from '../../../../services/tools.service';
|
||||
import { ToolsService, OpenThreadEvent, InstanceInfo } from '../../../../services/tools.service';
|
||||
import { NotificationService } from '../../../../services/notification.service';
|
||||
import { StatusWrapper } from '../../../../models/common.model';
|
||||
import { StatusesStateService, StatusState } from '../../../../services/statuses-state.service';
|
||||
|
@ -42,6 +42,7 @@ export class ActionBarComponent implements OnInit, OnDestroy {
|
|||
|
||||
isBoostLocked: boolean;
|
||||
isLocked: boolean;
|
||||
isBookmarksAvailable: boolean;
|
||||
|
||||
bookmarkingIsLoading: boolean;
|
||||
favoriteIsLoading: boolean;
|
||||
|
@ -144,11 +145,13 @@ export class ActionBarComponent implements OnInit, OnDestroy {
|
|||
if (status.sensitive || status.spoiler_text) {
|
||||
this.isContentWarningActive = true;
|
||||
}
|
||||
|
||||
|
||||
this.checkIfBookmarksAreAvailable(this.selectedAccounts[0]);
|
||||
this.checkIfFavorited();
|
||||
this.checkIfBoosted();
|
||||
this.checkIfBookmarked();
|
||||
}
|
||||
|
||||
|
||||
showContent(): boolean {
|
||||
this.isContentWarningActive = false;
|
||||
|
@ -314,6 +317,20 @@ export class ActionBarComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
private checkIfBookmarksAreAvailable(account: AccountInfo) {
|
||||
this.toolsService.getInstanceInfo(account)
|
||||
.then((instance: InstanceInfo) => {
|
||||
if(instance.major >= 3 && instance.minor >= 1){
|
||||
this.isBookmarksAvailable = true;
|
||||
} else {
|
||||
this.isBookmarksAvailable = false;
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.isBookmarksAvailable = false;
|
||||
});
|
||||
}
|
||||
|
||||
browseThread(event: OpenThreadEvent) {
|
||||
this.browseThreadEvent.next(event);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue