From 58414baa8edb94404e6007080d4e9115e60c02a6 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Tue, 1 Oct 2019 22:24:00 -0400 Subject: [PATCH] hide pixelfed unsupported polls/scheduling --- .../create-status/create-status.component.html | 10 ++++++---- .../create-status/create-status.component.ts | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/app/components/create-status/create-status.component.html b/src/app/components/create-status/create-status.component.html index a9d729f7..21b858f4 100644 --- a/src/app/components/create-status/create-status.component.html +++ b/src/app/components/create-status/create-status.component.html @@ -21,9 +21,9 @@ (suggestionSelectedEvent)="suggestionSelected($event)" (hasSuggestionsEvent)="suggestionsChanged($event)"> - + - + diff --git a/src/app/components/create-status/create-status.component.ts b/src/app/components/create-status/create-status.component.ts index 40e99007..9140b0d9 100644 --- a/src/app/components/create-status/create-status.component.ts +++ b/src/app/components/create-status/create-status.component.ts @@ -9,7 +9,7 @@ import { ContextMenuService, ContextMenuComponent } from 'ngx-contextmenu'; import { MastodonService, VisibilityEnum, PollParameters } from '../../services/mastodon.service'; import { Status, Attachment } from '../../services/models/mastodon.interfaces'; -import { ToolsService } from '../../services/tools.service'; +import { ToolsService, InstanceInfo, InstanceType } from '../../services/tools.service'; import { NotificationService } from '../../services/notification.service'; import { StatusWrapper } from '../../models/common.model'; import { AccountInfo } from '../../states/accounts.state'; @@ -109,6 +109,8 @@ export class CreateStatusComponent implements OnInit, OnDestroy { isSending: boolean; mentionTooFarAwayError: boolean; autosuggestData: string = null; + instanceSupportsPoll = true; + instanceSupportsScheduling = true; private statusLoaded: boolean; private hasSuggestions: boolean; @@ -295,6 +297,19 @@ export class CreateStatusComponent implements OnInit, OnDestroy { if (!this.statusReplyingToWrapper && !this.replyingUserHandle) { this.getDefaultPrivacy(); } + + this.toolsService.getInstanceInfo(this.selectedAccount) + .then((instance: InstanceInfo) => { + if(instance.type === InstanceType.Pixelfed){ + this.instanceSupportsPoll = false; + this.instanceSupportsScheduling = false; + this.pollIsActive = false; + this.scheduleIsActive = false; + } else { + this.instanceSupportsPoll = true; + this.instanceSupportsScheduling = true; + } + }); } }