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 31d818da..26a1c223 100644 --- a/src/app/components/create-status/create-status.component.spec.ts +++ b/src/app/components/create-status/create-status.component.spec.ts @@ -203,10 +203,24 @@ describe('CreateStatusComponent', () => { expect(result).toBe('
test @sengi_app@mastodon.social qsdqds qsd qsd qsd q @test@mastodon.social @no
'); }); + it('should tranform external mentions properly - mastodon 2', () => { + let mastodonMention = 'test @sengi_app qsdqds qsd qsd qsd q @test @no
'; + + const result =test @sengi_app@pleroma.site qsdqds qsd qsd qsd q @test@pleroma.site @no
'); + }); + it('should tranform external mentions properly - pleroma', () => { let pleromaMention = 'test @sengi_app qsdqds qsd qsd qsd q @test @no
'; const result =test @sengi_app@mastodon.social qsdqds qsd qsd qsd q @test@mastodon.social @no
'); }); + + it('should tranform external mentions properly - pleroma 2', () => { + let pleromaMention = 'test @sengi_app qsdqds qsd qsd qsd q @test @no
'; + + const result =test @sengi_app@pleroma.site qsdqds qsd qsd qsd q @test@pleroma.site @no
'); + }); }); \ No newline at end of file diff --git a/src/app/components/create-status/create-status.component.ts b/src/app/components/create-status/create-status.component.ts index 7aa3fb9b..3be1fff1 100644 --- a/src/app/components/create-status/create-status.component.ts +++ b/src/app/components/create-status/create-status.component.ts @@ -852,8 +852,8 @@ export class CreateStatusComponent implements OnInit, OnDestroy { } private tranformHtmlRepliesToReplies(data: string): string { - const mastodonMentionRegex = /@[a-zA-Z0-9_-]{0,255}<\/span><\/a><\/span>/gmi; - const pleromaMentionRegex = /@[a-zA-Z0-9_-]{0,255}<\/span><\/a><\/span>/gmi; + const mastodonMentionRegex = /@([a-zA-Z0-9_-]{0,255})<\/span><\/a><\/span>/gmi; + const pleromaMentionRegex = /@([a-zA-Z0-9_-]{0,255})<\/span><\/a><\/span>/gmi; while(data.match(mastodonMentionRegex)){ data = data.replace(mastodonMentionRegex, '@$2@$1');