Merge pull request #388 from NicolasConstant/develop

1.1.4 PR
This commit is contained in:
Nicolas Constant 2021-07-15 17:53:55 -04:00 committed by GitHub
commit 640028ca08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 20 deletions

View File

@ -32,7 +32,7 @@ addons:
install:
- nvm install 10.9.0
- npm install electron-builder@next
- npm install electron-builder@22.10.5
- npm install
- npm rebuild node-sass
- export DISPLAY=':99.0'
@ -44,4 +44,4 @@ before_script:
- sleep 3
script:
- npm run travis
- npm run travis

View File

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

View File

@ -225,7 +225,7 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
// this.status = state;
// } else {
if (!this.status || this.status === '') {
const uniqueMentions = this.getMentions(this.statusReplyingTo, this.statusReplyingToWrapper.provider);
const uniqueMentions = this.getMentions(this.statusReplyingTo);
for (const mention of uniqueMentions) {
this.status += `@${mention} `;
}
@ -492,8 +492,20 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
return cwLength;
}
private getMentions(status: Status, providerInfo: AccountInfo): string[] {
const mentions = [status.account.acct, ...status.mentions.map(x => x.acct)];
private getMentions(status: Status): string[] {
let acct = status.account.acct;
if(!acct.includes('@')) {
acct += `@${status.account.url.replace('https://', '').split('/')[0]}`
}
const mentions = [acct];
status.mentions.forEach(m => {
let mentionAcct = m.acct;
if(!mentionAcct.includes('@')){
mentionAcct += `@${m.url.replace('https://', '').split('/')[0]}`;
}
mentions.push(mentionAcct);
});
let uniqueMentions = [];
for (let mention of mentions) {
@ -502,22 +514,10 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
}
}
let globalUniqueMentions = [];
for (let mention of uniqueMentions) {
if (!mention.includes('@')) {
if (providerInfo) {
mention += `@${providerInfo.instance}`;
} else {
mention += `@${status.url.replace('https://', '').split('/')[0]}`;
}
}
globalUniqueMentions.push(mention);
}
const selectedUser = this.toolsService.getSelectedAccounts()[0];
globalUniqueMentions = globalUniqueMentions.filter(x => x.toLowerCase() !== `${selectedUser.username}@${selectedUser.instance}`.toLowerCase());
uniqueMentions = uniqueMentions.filter(x => x.toLowerCase() !== `${selectedUser.username}@${selectedUser.instance}`.toLowerCase());
return globalUniqueMentions;
return uniqueMentions;
}
onCtrlEnter(): boolean {