Merge pull request #135 from NicolasConstant/develop

0.12.1
This commit is contained in:
Nicolas Constant 2019-07-11 21:42:34 -04:00 committed by GitHub
commit 591bd34cac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 63 additions and 35 deletions

View File

@ -1,6 +1,6 @@
{
"name": "sengi",
"version": "0.12.0",
"version": "0.12.1",
"license": "AGPL-3.0-or-later",
"main": "main-electron.js",
"description": "A multi-account desktop client for Mastodon and Pleroma",

View File

@ -19,11 +19,12 @@
</div> -->
<div *ngIf="notification.type === 'follow'">
<div class="stream__notification--icon">
<div class="stream__notification--icon" title="{{notification.account.acct}}">
<fa-icon class="followed" [icon]="faUserPlus"></fa-icon>
</div>
<div class="stream__notification--label">
<a href class="stream__link"
title="{{notification.account.acct}}"
(click)="openAccount(notification.account)"
(auxclick)="openUrl(notification.account.url)"
innerHTML="{{ notification.account | accountEmoji }}"></a> followed

View File

@ -10,7 +10,7 @@ import { Notification, Account } from '../../../../services/models/mastodon.inte
import { MastodonService } from '../../../../services/mastodon.service';
import { NotificationService } from '../../../../services/notification.service';
import { AccountInfo } from '../../../../states/accounts.state';
import { OpenThreadEvent } from '../../../../services/tools.service';
import { OpenThreadEvent, ToolsService } from '../../../../services/tools.service';
@Component({
selector: 'app-notifications',
@ -46,6 +46,7 @@ export class NotificationsComponent implements OnInit, OnDestroy {
private lastId: string;
constructor(
private readonly toolsService: ToolsService,
private readonly notificationService: NotificationService,
private readonly userNotificationService: UserNotificationService,
private readonly mastodonService: MastodonService) { }
@ -126,10 +127,7 @@ export class NotificationsComponent implements OnInit, OnDestroy {
}
openAccount(account: Account): boolean {
let accountName = account.acct;
if (!accountName.includes('@'))
accountName += `@${account.url.replace('https://', '').split('/')[0]}`;
let accountName = this.toolsService.getAccountFullHandle(account);
this.browseAccountEvent.next(accountName);
return false;
}

View File

@ -16,7 +16,7 @@
<div *ngIf="accounts.length > 0" class="search-results">
<h3 class="search-results__title">Accounts</h3>
<a href *ngFor="let account of accounts" class="account" title="open account"
(click)="browseAccount(account.acct)">
(click)="browseAccount(account)">
<img src="{{account.avatar}}" class="account__avatar" />
<div class="account__name">{{ account.username }}</div>
<div class="account__fullhandle">@{{ account.acct }}</div>

View File

@ -54,10 +54,9 @@ export class SearchComponent implements OnInit {
return false;
}
browseAccount(accountName: string): boolean {
if (accountName) {
this.browseAccountEvent.next(accountName);
}
browseAccount(account: Account): boolean {
let accountName = this.toolsService.getAccountFullHandle(account);
this.browseAccountEvent.next(accountName);
return false;
}
@ -88,5 +87,5 @@ export class SearchComponent implements OnInit {
.then(() => { this.isLoading = false; });
}
private
private
}

View File

@ -1,5 +1,5 @@
<a class="account-icon"
href title="{{ account.info.id }}" (click)="toogleAccount()" (contextmenu)="openMenu()">
href title="{{ account.info.id }}" (click)="toogleAccount()" (auxclick)="openLocalAccount($event)" (contextmenu)="openMenu()">
<span class="hasActivity" *ngIf="account.hasActivityNotifications">new</span>
<img class="account-icon__avatar" [class.account-icon__avatar--selected]="account.info.isSelected" src="{{ account.avatar }}" />
</a>

View File

@ -1,7 +1,10 @@
import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core';
import { AccountWrapper } from '../../../models/account.models';
import { Account } from "../../../services/models/mastodon.interfaces";
import { AccountWithNotificationWrapper } from '../left-side-bar.component';
import { ToolsService } from '../../../services/tools.service';
import { NotificationService } from '../../../services/notification.service';
@Component({
selector: 'app-account-icon',
@ -13,9 +16,14 @@ export class AccountIconComponent implements OnInit {
@Output() toogleAccountNotify = new EventEmitter<AccountWrapper>();
@Output() openMenuNotify = new EventEmitter<AccountWrapper>();
constructor() { }
private promiseGetUser: Promise<Account>;
constructor(
private readonly notificationService: NotificationService,
private readonly mastodonTools: ToolsService) { }
ngOnInit() {
this.promiseGetUser = this.mastodonTools.findAccount(this.account.info, `@${this.account.info.username}@${this.account.info.instance}`);
}
toogleAccount(): boolean {
@ -27,4 +35,19 @@ export class AccountIconComponent implements OnInit {
this.openMenuNotify.emit(this.account);
return false;
}
openLocalAccount(e): boolean {
e.preventDefault();
if (e.which == 2) {
this.promiseGetUser
.then((account: Account) => {
window.open(account.url, '_blank');
})
.catch(err => {
this.notificationService.notifyHttpError(err);
});
return false;
}
}
}

View File

@ -16,9 +16,9 @@
</button>
<div *ngFor="let att of attachments" class="media-viewer-canvas__attachement"
[ngClass]="{ 'collapsed': currentIndex !== att.index }">
<a href="{{att.url}}" target="_blank" title="open image">
<img *ngIf="att.type === 'image'" src="{{att.url}}" class="media-viewer-canvas__image" />
[class.collapsed]="currentIndex !== att.index">
<a href="{{att.url}}" target="_blank" title="{{att.description}}">
<img *ngIf="att.type === 'image'" src="{{att.url}}" class="media-viewer-canvas__image" [class.collapsed]="currentIndex !== att.index" />
</a>
<video *ngIf="att.type === 'gifv'" class="media-viewer-canvas__image" role="application" loop autoplay>

View File

@ -76,7 +76,7 @@
max-width: 95%;
}
max-height: calc(100% - 120px);
max-height: 90vh;
margin-top: 50vh;
margin-left: 50vw;
transform: translate(-50%, -50%);
@ -104,4 +104,5 @@
.collapsed {
height: 0;
max-height: 0;
}

View File

@ -108,11 +108,9 @@ export class ActionBarComponent implements OnInit, OnDestroy {
private extractHandle(account: Account) {
this.username = account.acct.split('@')[0];
this.fullHandle = account.acct.toLowerCase();
if (!this.fullHandle.includes('@')) {
this.fullHandle += `@${account.url.replace('https://', '').split('/')[0]}`;
}
this.fullHandle = `@${this.fullHandle}`;
this.fullHandle = this.toolsService.getAccountFullHandle(account);
// this.fullHandle = `@${this.fullHandle}`;
}
ngOnDestroy(): void {

View File

@ -1,6 +1,7 @@
<div class="status-wrapper" [class.direct-message]="isDirectMessage">
<div class="reblog" *ngIf="reblog">
<a class="reblog__profile-link" href (click)="openAccount(status.account)"
<a class="reblog__profile-link" href title="{{ status.account.acct }}"
(click)="openAccount(status.account)"
(auxclick)="openUrl(status.account.url)"><span innerHTML="{{ status.account | accountEmoji }}"></span> <img
*ngIf="reblog" class="reblog__avatar" src="{{ status.account.avatar }}" /></a> boosted
</div>
@ -17,7 +18,8 @@
<fa-icon class="favorite" [icon]="faStar"></fa-icon>
</div>
<div class="notification--label">
<a href class="notification--link" title="open account" (click)="openAccount(notificationAccount)"
<a href class="notification--link" title="{{ notificationAccount.acct }}"
(click)="openAccount(notificationAccount)"
(auxclick)="openUrl(notificationAccount.url)" innerHTML="{{ notificationAccount | accountEmoji }}"></a>
favorited your status
</div>
@ -27,7 +29,8 @@
<fa-icon class="boost" [icon]="faRetweet"></fa-icon>
</div>
<div class="notification--label">
<a href class="notification--link" title="open account" (click)="openAccount(notificationAccount)"
<a href class="notification--link" title="{{ notificationAccount.acct }}"
(click)="openAccount(notificationAccount)"
(auxclick)="openUrl(notificationAccount.url)" innerHTML="{{ notificationAccount | accountEmoji }}"></a>
boosted your status
</div>

View File

@ -84,7 +84,8 @@ export class StatusComponent implements OnInit {
return this._statusWrapper;
}
constructor() { }
constructor(
private readonly toolsService: ToolsService) { }
ngOnInit() {
}
@ -137,10 +138,7 @@ export class StatusComponent implements OnInit {
}
openAccount(account: Account): boolean {
let accountName = account.acct;
if (!accountName.includes('@'))
accountName += `@${account.url.replace('https://', '').split('/')[0]}`;
let accountName = this.toolsService.getAccountFullHandle(account);
this.browseAccountEvent.next(accountName);
return false;
}

View File

@ -11,7 +11,6 @@ import { AccountSettings, SaveAccountSettings } from '../states/settings.state';
providedIn: 'root'
})
export class ToolsService {
constructor(
private readonly mastodonService: MastodonService,
private readonly store: Store) { }
@ -50,8 +49,9 @@ export class ToolsService {
const foundAccount = result.accounts.find(
x => (x.acct.toLowerCase() === accountName.toLowerCase()
|| x.acct.toLowerCase().split('@')[0] === accountName.toLowerCase().split('@')[0])
&& x.url.replace('https://', '').split('/')[0] === accountName.toLowerCase().split('@')[1]
||
(x.acct.toLowerCase().split('@')[0] === accountName.toLowerCase().split('@')[0])
&& x.url.replace('https://', '').split('/')[0] === accountName.toLowerCase().split('@')[1])
);
return foundAccount;
});
@ -75,6 +75,13 @@ export class ToolsService {
return statusPromise;
}
getAccountFullHandle(account: Account): string {
let fullHandle = account.acct.toLowerCase();
if (!fullHandle.includes('@')) {
fullHandle += `@${account.url.replace('https://', '').split('/')[0]}`;
}
return `@${fullHandle}`;
}
}
export class OpenThreadEvent {