diff --git a/package.json b/package.json
index 358fb63d..0583e29f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "sengi",
- "version": "1.6.0",
+ "version": "1.7.0",
"license": "AGPL-3.0-or-later",
"main": "main-electron.js",
"description": "A multi-account desktop client for Mastodon and Pleroma",
diff --git a/src/app/components/create-status/create-status.component.spec.ts b/src/app/components/create-status/create-status.component.spec.ts
index 3a438669..0f60b739 100644
--- a/src/app/components/create-status/create-status.component.spec.ts
+++ b/src/app/components/create-status/create-status.component.spec.ts
@@ -15,7 +15,7 @@ import { NavigationService } from '../../services/navigation.service';
import { NotificationService } from '../../services/notification.service';
import { MastodonService } from '../../services/mastodon.service';
import { AuthService } from '../../services/auth.service';
-
+import { SettingsState } from '../../states/settings.state';
describe('CreateStatusComponent', () => {
let component: CreateStatusComponent;
@@ -33,7 +33,8 @@ describe('CreateStatusComponent', () => {
NgxsModule.forRoot([
RegisteredAppsState,
AccountsState,
- StreamsState
+ StreamsState,
+ SettingsState
]),
],
providers: [NavigationService, NotificationService, MastodonService, AuthService],
diff --git a/src/app/components/create-status/create-status.component.ts b/src/app/components/create-status/create-status.component.ts
index a3282fe7..9de118de 100644
--- a/src/app/components/create-status/create-status.component.ts
+++ b/src/app/components/create-status/create-status.component.ts
@@ -127,6 +127,13 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
// this.statusStateService.setStatusContent(this.status, this.statusReplyingToWrapper);
+ // Retrieve mentions
+ for(let mention of value.status.mentions){
+ if(this.status){
+ this.status = this.status.replace(`@${mention.username}`, `@${mention.acct}`);
+ }
+ }
+
this.setVisibilityFromStatus(value.status);
this.title = value.status.spoiler_text;
this.statusLoaded = true;
diff --git a/src/app/components/floating-column/floating-column.component.html b/src/app/components/floating-column/floating-column.component.html
index 4c697f53..507e96ff 100644
--- a/src/app/components/floating-column/floating-column.component.html
+++ b/src/app/components/floating-column/floating-column.component.html
@@ -10,7 +10,7 @@
diff --git a/src/app/components/floating-column/floating-column.component.scss b/src/app/components/floating-column/floating-column.component.scss
index efe59b60..82a6a6a2 100644
--- a/src/app/components/floating-column/floating-column.component.scss
+++ b/src/app/components/floating-column/floating-column.component.scss
@@ -29,9 +29,20 @@
}
.close-button {
+ // outline: 1px dotted orange;
+
display: block;
float: right;
font-size: 14px;
color: white;
- margin: 10px 16px 0 0;
+ margin: 5px 5px 0 0;
+
+ width: 40px;
+ height: 34px;
+
+ &__icon {
+ position: relative;
+ top: 6px;
+ left: 17px;
+ }
}
\ No newline at end of file
diff --git a/src/app/components/floating-column/manage-account/my-account/my-account.component.ts b/src/app/components/floating-column/manage-account/my-account/my-account.component.ts
index 58710d92..0819fc95 100644
--- a/src/app/components/floating-column/manage-account/my-account/my-account.component.ts
+++ b/src/app/components/floating-column/manage-account/my-account/my-account.component.ts
@@ -122,6 +122,17 @@ export class MyAccountComponent implements OnInit, OnDestroy {
}
}
})
+ .then(_ => {
+ this.availableLists.sort((a,b) => {
+ if (a.name < b.name) {
+ return -1;
+ }
+ if (a.name > b.name) {
+ return 1;
+ }
+ return 0;
+ });
+ })
.catch(err => {
this.notificationService.notifyHttpError(err, this.account.info);
});
diff --git a/src/app/components/floating-column/manage-account/notifications/notification/notification.component.html b/src/app/components/floating-column/manage-account/notifications/notification/notification.component.html
index 59bc569c..7856a4f3 100644
--- a/src/app/components/floating-column/manage-account/notifications/notification/notification.component.html
+++ b/src/app/components/floating-column/manage-account/notifications/notification/notification.component.html
@@ -70,17 +70,29 @@
+ [statusWrapper]="notification.status"
+ [notificationAccount]="notification.account"
+ [notificationType]="notification.type"
+ [context]="'notifications'"
+ (browseAccountEvent)="browseAccount($event)"
+ (browseHashtagEvent)="browseHashtag($event)"
+ (browseThreadEvent)="browseThread($event)">
+ [statusWrapper]="notification.status"
+ [context]="'notifications'"
+ (browseAccountEvent)="browseAccount($event)"
+ (browseHashtagEvent)="browseHashtag($event)"
+ (browseThreadEvent)="browseThread($event)">
+ class="stream__status"
+ [statusWrapper]="notification.status"
+ [notificationAccount]="notification.account"
+ [notificationType]="notification.type"
+ [context]="'notifications'"
+ (browseAccountEvent)="browseAccount($event)"
+ (browseHashtagEvent)="browseHashtag($event)"
+ (browseThreadEvent)="browseThread($event)">
\ No newline at end of file
diff --git a/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.html b/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.html
index 957bb122..08481752 100644
--- a/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.html
+++ b/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.html
@@ -1,5 +1,8 @@
-
ALT
+
ALT
+
+
+
diff --git a/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.scss b/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.scss
index 44a95067..267d24e5 100644
--- a/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.scss
+++ b/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.scss
@@ -25,11 +25,31 @@
// }
}
+ &__status {
+ z-index: 10;
+ position: absolute;
+ top: 0;
+ right: 25px;
+ padding: 5px 5px 8px 8px;
+ transition: all .2s;
+ opacity: 0;
+ color: white;
+
+ &--icon {
+ filter: drop-shadow(0 0 3px rgb(78, 78, 78));
+ }
+ }
+
&:hover &__link {
opacity: 1;
cursor: pointer;
}
+ &:hover &__status {
+ opacity: 1;
+ cursor: pointer;
+ }
+
&__alt {
display: inline;
color: white;
diff --git a/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.ts b/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.ts
index 2568f66b..b584be61 100644
--- a/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.ts
+++ b/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.ts
@@ -1,8 +1,10 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
-import { faLink } from "@fortawesome/free-solid-svg-icons";
+import { faLink, faExternalLinkAlt } from "@fortawesome/free-solid-svg-icons";
import { SettingsService } from '../../../../../services/settings.service';
import { Attachment } from '../../../../../services/models/mastodon.interfaces';
+import { StatusWrapper } from '../../../../../models/common.model';
+import { OpenThreadEvent } from '../../../../../services/tools.service';
@Component({
selector: 'app-attachement-image',
@@ -11,10 +13,13 @@ import { Attachment } from '../../../../../services/models/mastodon.interfaces';
})
export class AttachementImageComponent implements OnInit {
faLink = faLink;
+ faExternalLinkAlt = faExternalLinkAlt;
displayAltLabel: boolean;
@Input() attachment: Attachment;
+ @Input() status: StatusWrapper;
@Output() openEvent = new EventEmitter();
+ @Output() browseThreadEvent = new EventEmitter
();
constructor(
private readonly settingsService: SettingsService
@@ -34,4 +39,13 @@ export class AttachementImageComponent implements OnInit {
window.open(this.attachment.url, '_blank');
return false;
}
+
+ openStatus(): boolean {
+ if(!this.status) return false;
+
+ const openThreadEvent = new OpenThreadEvent(this.status.status, this.status.provider);
+ this.browseThreadEvent.next(openThreadEvent);
+
+ return false;
+ }
}
diff --git a/src/app/components/stream/status/databinded-text/databinded-text.component.spec.ts b/src/app/components/stream/status/databinded-text/databinded-text.component.spec.ts
index f75252f9..076f8e76 100644
--- a/src/app/components/stream/status/databinded-text/databinded-text.component.spec.ts
+++ b/src/app/components/stream/status/databinded-text/databinded-text.component.spec.ts
@@ -202,7 +202,7 @@ describe('DatabindedTextComponent', () => {
const sample = `Bla #KubeCon Bla
`;
component.text = sample;
- expect(component.processedText).toContain('Bla #KubeCon Bla
');
+ expect(component.processedText).toContain('Bla #KubeCon Bla
');
});
it('should parse link - Pleroma', () => {
diff --git a/src/app/components/stream/status/poll/poll.component.ts b/src/app/components/stream/status/poll/poll.component.ts
index ef227e2d..8e6e0b9c 100644
--- a/src/app/components/stream/status/poll/poll.component.ts
+++ b/src/app/components/stream/status/poll/poll.component.ts
@@ -45,7 +45,15 @@ export class PollComponent implements OnInit {
}
this.options.length = 0;
- const maxVotes = Math.max(...this.poll.options.map(x => x.votes_count));
+
+ let maxVotes = Math.max(...this.poll.options.map(x => x.votes_count));
+
+ if(!this.poll.multiple){ //Fix for absurd values in pleroma
+ this.poll.voters_count = this.poll.votes_count;
+ } else if(this.poll.voters_count * this.poll.options.length < this.poll.votes_count){
+ this.poll.voters_count = this.poll.votes_count;
+ }
+
let i = 0;
for (let opt of this.poll.options) {
let optWrapper = new PollOptionWrapper(i, opt, this.poll.votes_count, this.poll.voters_count, opt.votes_count === maxVotes);
@@ -195,7 +203,7 @@ class PollOptionWrapper implements PollOption {
if (totalVotes === 0) {
this.percentage = '0';
} else {
- this.percentage = ((this.votes_count / votesDivider) * 100).toFixed(0);
+ this.percentage = ((this.votes_count / votesDivider) * 100).toFixed(0);
}
this.isMax = isMax;
}
diff --git a/src/app/components/stream/status/status.component.ts b/src/app/components/stream/status/status.component.ts
index 11d4ee0c..9b670451 100644
--- a/src/app/components/stream/status/status.component.ts
+++ b/src/app/components/stream/status/status.component.ts
@@ -59,6 +59,8 @@ export class StatusComponent implements OnInit {
@Input() notificationType: 'mention' | 'reblog' | 'favourite' | 'poll' | 'update';
@Input() notificationAccount: Account;
+ @Input() context: 'home' | 'notifications' | 'public' | 'thread' | 'account';
+
private _statusWrapper: StatusWrapper;
status: Status;
@@ -98,6 +100,8 @@ export class StatusComponent implements OnInit {
// this.statusAccountName = this.emojiConverter.applyEmojis(this.displayedStatus.account.emojis, this.displayedStatus.account.display_name, EmojiTypeEnum.small);
let statusContent = this.emojiConverter.applyEmojis(this.displayedStatus.emojis, this.displayedStatus.content, EmojiTypeEnum.medium);
this.statusContent = this.ensureMentionAreDisplayed(statusContent);
+
+ this.validateFilteringStatus();
}
get statusWrapper(): StatusWrapper {
return this._statusWrapper;
@@ -123,6 +127,36 @@ export class StatusComponent implements OnInit {
if (this.statusesStateServiceSub) this.statusesStateServiceSub.unsubscribe();
}
+ private validateFilteringStatus(){
+ const filterStatus = this.displayedStatus.filtered;
+
+ if(!filterStatus || filterStatus.length === 0) return;
+
+ // if(!this.context){
+ // console.warn('this.context not found');
+ // console.warn(this.context);
+ // }
+
+ for (let filter of filterStatus) {
+ if(this.context && filter.filter.context && filter.filter.context.length > 0){
+ if(!filter.filter.context.includes(this.context)) continue;
+ }
+
+ if(filter.filter.filter_action === 'warn'){
+ this.isContentWarned = true;
+
+ let filterTxt = `FILTERED:`;
+ for(let w of filter.keyword_matches){
+ filterTxt += ` ${w}`;
+ }
+
+ this.contentWarningText = filterTxt;
+ } else if (filter.filter.filter_action === 'hide'){
+ this.hideStatus = true;
+ }
+ }
+ }
+
getAvatar(acc: Account): string {
if(this.freezeAvatarEnabled){
return acc.avatar_static;
diff --git a/src/app/components/stream/stream-notifications/stream-notifications.component.ts b/src/app/components/stream/stream-notifications/stream-notifications.component.ts
index c79b4ed2..d21186f7 100644
--- a/src/app/components/stream/stream-notifications/stream-notifications.component.ts
+++ b/src/app/components/stream/stream-notifications/stream-notifications.component.ts
@@ -122,7 +122,7 @@ export class StreamNotificationsComponent extends BrowseBase {
loadNotifications(): any {
this.account = this.toolsService.getAccountById(this.streamElement.accountId);
- this.mentionsSubscription = this.userNotificationService.userNotifications.subscribe((userNotifications: UserNotification[]) => {
+ this.mentionsSubscription = this.userNotificationService.userNotifications.subscribe((userNotifications: UserNotification[]) => {
this.loadMentions(userNotifications);
});
@@ -130,10 +130,13 @@ export class StreamNotificationsComponent extends BrowseBase {
.then((notifications: Notification[]) => {
this.isNotificationsLoading = false;
- this.notifications = notifications.map(x => {
+ let wrappedNotification= notifications.map(x => {
let cwPolicy = this.toolsService.checkContentWarning(x.status);
return new NotificationWrapper(x, this.account, cwPolicy.applyCw, cwPolicy.hide);
});
+
+ this.notifications = wrappedNotification.filter(x => x.type !== 'mention' || (x.type === 'mention' && x.status.status !== null));
+
this.lastNotificationId = this.notifications[this.notifications.length - 1].notification.id;
})
.catch(err => {
diff --git a/src/app/components/stream/stream-overlay/stream-overlay.component.html b/src/app/components/stream/stream-overlay/stream-overlay.component.html
index 0ced8ea6..42f9e0fb 100644
--- a/src/app/components/stream/stream-overlay/stream-overlay.component.html
+++ b/src/app/components/stream/stream-overlay/stream-overlay.component.html
@@ -1,9 +1,5 @@
diff --git a/src/app/components/stream/stream-overlay/stream-overlay.component.scss b/src/app/components/stream/stream-overlay/stream-overlay.component.scss
index 84cb7962..a33eb851 100644
--- a/src/app/components/stream/stream-overlay/stream-overlay.component.scss
+++ b/src/app/components/stream/stream-overlay/stream-overlay.component.scss
@@ -11,7 +11,9 @@ $header-content-height: 40px;
width: calc(100%);
height: $header-content-height;
background-color: $column-header-background-color;
- border-bottom: 1px solid #222736;
+ border-bottom: 1px solid #222736;
+
+ display: flex;
}
&__content-wrapper {
transition: all .2s;
@@ -44,11 +46,17 @@ $header-content-height: 40px;
}
&__button {
+ // outline: 1px dotted orange;
+
width: 25px;
height: 25px;
+
+ width: $header-content-height;
+ height: $header-content-height;
+
color: #354060;
transition: all .2s;
- margin: 8px 0 0 8px;
+
&:hover {
color: #536599;
color: #7a8dc7;
@@ -68,19 +76,8 @@ $header-content-height: 40px;
&__icon {
position: relative;
- left: 7px;
- top: -1px
- }
- }
- &-next {
- display: block;
- float: left;
- font-size: 18px;
-
- &__icon {
- position: relative;
- left: 8px;
- top: -1px
+ left: 17px;
+ top: 7px
}
}
&-refresh {
@@ -90,29 +87,38 @@ $header-content-height: 40px;
&__icon {
position: relative;
- left: 5px;
- top: 1px
+ left: 13px;
+ top: 9px
+ }
+ }
+ &-next {
+ display: block;
+ float: left;
+ font-size: 18px;
+
+ &__icon {
+ position: relative;
+ left: 13px;
+ top: 7px
}
}
&-gototop {
- position: absolute;
- top: 0;
- left: 110px;
- right: 40px;
+ // outline: 1px dotted orange;
+
+ flex-grow: 1;
+
display: block;
height: $header-content-height;
}
&-close {
display: block;
- float: right;
font-size: 13px;
color: white;
- margin-right: 8px;
&__icon {
position: relative;
- left: 7px;
- top: 1px
+ left: 15px;
+ top: 9px
}
}
}
diff --git a/src/app/components/stream/stream-statuses/stream-statuses.component.html b/src/app/components/stream/stream-statuses/stream-statuses.component.html
index f839daf8..774b19e0 100644
--- a/src/app/components/stream/stream-statuses/stream-statuses.component.html
+++ b/src/app/components/stream/stream-statuses/stream-statuses.component.html
@@ -17,8 +17,11 @@
diff --git a/src/app/components/stream/stream-statuses/stream-statuses.component.ts b/src/app/components/stream/stream-statuses/stream-statuses.component.ts
index 129dc1ce..6febdabb 100644
--- a/src/app/components/stream/stream-statuses/stream-statuses.component.ts
+++ b/src/app/components/stream/stream-statuses/stream-statuses.component.ts
@@ -3,7 +3,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import { Observable, Subscription } from 'rxjs';
import { Store } from '@ngxs/store';
-import { StreamElement } from '../../../states/streams.state';
+import { StreamElement, StreamTypeEnum } from '../../../states/streams.state';
import { AccountInfo } from '../../../states/accounts.state';
import { StreamingService, EventEnum, StatusUpdate } from '../../../services/streaming.service';
import { Status } from '../../../services/models/mastodon.interfaces';
@@ -20,9 +20,11 @@ import { SettingsService } from '../../../services/settings.service';
templateUrl: './stream-statuses.component.html',
styleUrls: ['./stream-statuses.component.scss']
})
-export class StreamStatusesComponent extends TimelineBase {
+export class StreamStatusesComponent extends TimelineBase {
protected _streamElement: StreamElement;
+ context: 'home' | 'notifications' | 'public' | 'thread' | 'account';
+
@Input()
set streamElement(streamElement: StreamElement) {
this._streamElement = streamElement;
@@ -32,6 +34,8 @@ export class StreamStatusesComponent extends TimelineBase {
this.hideReplies = streamElement.hideReplies;
this.load(this._streamElement);
+
+ this.setContext(this._streamElement);
}
get streamElement(): StreamElement {
return this._streamElement;
@@ -112,6 +116,24 @@ export class StreamStatusesComponent extends TimelineBase {
if (this.deleteStatusSubscription) this.deleteStatusSubscription.unsubscribe();
}
+ private setContext(streamElement: StreamElement) {
+ switch(streamElement.type){
+ case StreamTypeEnum.global:
+ case StreamTypeEnum.local:
+ case StreamTypeEnum.tag:
+ this.context = 'public';
+ break;
+ case StreamTypeEnum.personnal:
+ case StreamTypeEnum.list:
+ this.context = 'home';
+ break;
+ case StreamTypeEnum.activity:
+ case StreamTypeEnum.directmessages:
+ this.context = 'notifications';
+ break;
+ }
+ }
+
refresh(): any {
this.load(this._streamElement);
}
diff --git a/src/app/components/stream/thread/thread.component.ts b/src/app/components/stream/thread/thread.component.ts
index 076416fb..7a6a98bc 100644
--- a/src/app/components/stream/thread/thread.component.ts
+++ b/src/app/components/stream/thread/thread.component.ts
@@ -28,6 +28,8 @@ export class ThreadComponent extends BrowseBase {
hasContentWarnings = false;
private remoteStatusFetchingDisabled = false;
+ context = 'thread';
+
numNewItems: number; //html compatibility only
bufferStream: Status[] = []; //html compatibility only
streamPositionnedAtTop: boolean = true; //html compatibility only
diff --git a/src/app/components/stream/user-profile/user-profile.component.html b/src/app/components/stream/user-profile/user-profile.component.html
index 50c69c55..4edc7df3 100644
--- a/src/app/components/stream/user-profile/user-profile.component.html
+++ b/src/app/components/stream/user-profile/user-profile.component.html
@@ -166,39 +166,27 @@
@@ -208,21 +196,29 @@
diff --git a/src/app/components/stream/user-profile/user-profile.component.scss b/src/app/components/stream/user-profile/user-profile.component.scss
index cab3bebb..d67cf410 100644
--- a/src/app/components/stream/user-profile/user-profile.component.scss
+++ b/src/app/components/stream/user-profile/user-profile.component.scss
@@ -275,14 +275,15 @@ $floating-header-height: 60px;
&-follows {
width: calc(100%);
font-size: 13px;
- border-bottom: 1px solid #0f111a;;
+ border-bottom: 1px solid #0f111a;
+
+ display: flex;
&__link {
color: white;
- width: calc(50%);
+ flex-grow: 1;
padding: 5px;
text-align: center;
- display: inline-block;
background-color: #1a1f2e;
transition: all .2s;
@@ -311,15 +312,15 @@ $floating-header-height: 60px;
font-size: 13px;
transition: all .4s;
- &__section {
- text-align: center;
- display: inline-block;
- width: calc(33.333% - 5px);
- padding: 5px 0 7px 0;
+ display: flex;
- &:not(:last-child) {
- margin-right: 5px;
- }
+ &__section {
+ // outline: 1px dotted orange;
+
+ flex-grow: 1;
+
+ text-align: center;
+ padding: 5px 0 7px 0;
}
&__preparefloating {
diff --git a/src/app/components/stream/user-profile/user-profile.component.ts b/src/app/components/stream/user-profile/user-profile.component.ts
index 81033a7f..47f9236b 100644
--- a/src/app/components/stream/user-profile/user-profile.component.ts
+++ b/src/app/components/stream/user-profile/user-profile.component.ts
@@ -7,7 +7,7 @@ import { Store } from '@ngxs/store';
import { Account, Status, Relationship, Attachment } from "../../../services/models/mastodon.interfaces";
import { MastodonWrapperService } from '../../../services/mastodon-wrapper.service';
-import { ToolsService, OpenThreadEvent } from '../../../services/tools.service';
+import { ToolsService, OpenThreadEvent, InstanceType } from '../../../services/tools.service';
import { NotificationService } from '../../../services/notification.service';
import { AccountInfo } from '../../../states/accounts.state';
import { StatusWrapper, OpenMediaEvent } from '../../../models/common.model';
@@ -286,21 +286,44 @@ export class UserProfileComponent extends BrowseBase {
}
follow(): boolean {
+ this.loadingRelationShip = true;
+
const userAccount = this.toolsService.getSelectedAccounts()[0];
+
+ let foundAccountToFollow: Account;
this.toolsService.findAccount(userAccount, this.lastAccountName)
.then((account: Account) => {
+ foundAccountToFollow = account;
return this.mastodonService.follow(userAccount, account);
})
.then((relationship: Relationship) => {
- this.relationship = relationship;
+ this.relationship = relationship;
+ })
+ .then(async () => {
+ // Double check for pleroma users
+ const instanceInfo = await this.toolsService.getInstanceInfo(userAccount);
+ if(instanceInfo.type === InstanceType.Pleroma || instanceInfo.type === InstanceType.Akkoma){
+ await new Promise(resolve => setTimeout(resolve, 1000))
+
+ const relationships = await this.mastodonService.getRelationships(userAccount, [foundAccountToFollow]);
+ const relationship = relationships.find(x => x.id === foundAccountToFollow.id);
+ if(relationship){
+ this.relationship = relationship;
+ }
+ }
})
.catch((err: HttpErrorResponse) => {
this.notificationService.notifyHttpError(err, userAccount);
+ })
+ .then(() => {
+ this.loadingRelationShip = false;
});
return false;
}
unfollow(): boolean {
+ this.loadingRelationShip = true;
+
const userAccount = this.toolsService.getSelectedAccounts()[0];
this.toolsService.findAccount(userAccount, this.lastAccountName)
.then((account: Account) => {
@@ -311,6 +334,9 @@ export class UserProfileComponent extends BrowseBase {
})
.catch((err: HttpErrorResponse) => {
this.notificationService.notifyHttpError(err, userAccount);
+ })
+ .then(() => {
+ this.loadingRelationShip = false;
});
return false;
}
diff --git a/src/app/services/electron.service.spec.ts b/src/app/services/electron.service.spec.ts
index 38fe2f0e..911a69e7 100644
--- a/src/app/services/electron.service.spec.ts
+++ b/src/app/services/electron.service.spec.ts
@@ -1,12 +1,12 @@
import { TestBed } from '@angular/core/testing';
-import { ElectronService } from './electron.service';
+import { MyElectronService } from './electron.service';
-describe('ElectronService', () => {
+xdescribe('MyElectronService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
- const service: ElectronService = TestBed.get(ElectronService);
+ const service: MyElectronService = TestBed.get(MyElectronService);
expect(service).toBeTruthy();
});
});
diff --git a/src/app/services/instances-info.service.ts b/src/app/services/instances-info.service.ts
index b4a2ece5..7f22b5c0 100644
--- a/src/app/services/instances-info.service.ts
+++ b/src/app/services/instances-info.service.ts
@@ -31,6 +31,8 @@ export class InstancesInfoService {
const instanceV1 =
instance;
if (instanceV1 && instanceV1.max_toot_chars)
return instanceV1.max_toot_chars;
+ if(instanceV1 && instanceV1.configuration && instanceV1.configuration.statuses && instanceV1.configuration.statuses.max_characters)
+ return instanceV1.configuration.statuses.max_characters;
}
return this.defaultMaxChars;
diff --git a/src/app/services/mastodon.service.ts b/src/app/services/mastodon.service.ts
index cc69ce0f..418a316d 100644
--- a/src/app/services/mastodon.service.ts
+++ b/src/app/services/mastodon.service.ts
@@ -398,11 +398,13 @@ export class MastodonService {
uploadMediaAttachment(account: AccountInfo, file: File, description: string): Promise {
let input = new FormData();
input.append('file', file);
+
if (description !== null && description !== undefined) {
input.append('description', description);
} else {
input.append('description', '');
}
+
const route = `https://${account.instance}${this.apiRoutes.uploadMediaAttachment}`;
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });
return this.httpClient.post(route, input, { headers: headers }).toPromise();
@@ -411,7 +413,13 @@ export class MastodonService {
//TODO: add focus support
updateMediaAttachment(account: AccountInfo, mediaId: string, description: string): Promise {
let input = new FormData();
- input.append('description', description);
+
+ if (description !== null && description !== undefined) {
+ input.append('description', description);
+ } else {
+ input.append('description', '');
+ }
+
const route = `https://${account.instance}${this.apiRoutes.updateMediaAttachment.replace('{0}', mediaId)}`;
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });
return this.httpClient.put(route, input, { headers: headers }).toPromise();
diff --git a/src/app/services/models/mastodon.interfaces.ts b/src/app/services/models/mastodon.interfaces.ts
index 492eede7..860bf6a4 100644
--- a/src/app/services/models/mastodon.interfaces.ts
+++ b/src/app/services/models/mastodon.interfaces.ts
@@ -124,6 +124,7 @@ export interface Instancev1 extends Instance {
urls: InstanceUrls;
contact_account: Account;
max_toot_chars: number;
+ configuration: Instancev2Configuration;
}
export interface Instancev2 extends Instance {
@@ -193,6 +194,33 @@ export interface Results {
hashtags: string[];
}
+export interface FilterKeyword {
+ id: string;
+ keyword: string;
+ whole_word: boolean;
+}
+
+export interface FilterStatus {
+ id: string;
+ status_id: string;
+}
+
+export interface Filter {
+ id: string;
+ title: string;
+ context: string[]; //home notifications public thread account
+ expires_at: string;
+ filter_action: string; //warn hide
+ keywords: FilterKeyword[];
+ statuses: FilterStatus[];
+}
+
+export interface FilterResult {
+ filter: Filter;
+ keyword_matches: string[];
+ status_matches: string[];
+}
+
export interface Status {
id: string;
uri: string;
@@ -223,6 +251,7 @@ export interface Status {
bookmarked: boolean;
card: Card;
poll: Poll;
+ filtered: FilterResult[];
pleroma: PleromaStatusInfo;
}
diff --git a/src/app/services/user-notification.service.ts b/src/app/services/user-notification.service.ts
index 6ca0fb9d..9f7701cf 100644
--- a/src/app/services/user-notification.service.ts
+++ b/src/app/services/user-notification.service.ts
@@ -60,6 +60,8 @@ export class UserNotificationService {
private startFetchingNotifications(account: AccountInfo) {
let getMentionsPromise = this.mastodonService.getNotifications(account, ['favourite', 'follow', 'reblog', 'poll', 'follow_request', 'move', 'update'], null, null, 10)
.then((notifications: Notification[]) => {
+ notifications = notifications.filter(x => x.status !== null);
+
this.processMentionsAndNotifications(account, notifications, NotificationTypeEnum.UserMention);
})
.catch(err => {