Skip to content

Commit

Permalink
Merge pull request #388 from NicolasConstant/develop
Browse files Browse the repository at this point in the history
1.1.4 PR
  • Loading branch information
NicolasConstant authored Jul 15, 2021
2 parents 9426bc9 + 3f01c70 commit 640028c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -44,4 +44,4 @@ before_script:
- sleep 3

script:
- npm run travis
- npm run travis
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
34 changes: 17 additions & 17 deletions src/app/components/create-status/create-status.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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} `;
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down

0 comments on commit 640028c

Please sign in to comment.