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 c19b2898..c6c07eea 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 @@ -120,4 +120,11 @@ describe('DatabindedTextComponent', () => { component.text = sample; expect(component.processedText).toContain('
'); }); -}); + + it('should parse mention - Friendica in Mastodon', () => { + const sample = `@me Blablabla.`; + + component.text = sample; + expect(component.processedText).toContain('@me Blablabla.'); + }); +}); \ No newline at end of file diff --git a/src/app/components/stream/status/databinded-text/databinded-text.component.ts b/src/app/components/stream/status/databinded-text/databinded-text.component.ts index dfac70be..da057c35 100644 --- a/src/app/components/stream/status/databinded-text/databinded-text.component.ts +++ b/src/app/components/stream/status/databinded-text/databinded-text.component.ts @@ -22,10 +22,13 @@ export class DatabindedTextComponent implements OnInit { @Input('text') set text(value: string) { - // console.warn('text'); - // console.warn(value); + console.warn('text'); + console.warn(value); this.processedText = ''; + + value = value.replace('@', ''); //Friendica sanitarization + let linksSections = value.split('')) { //GNU social + if(section.includes('')){ //Friendica + extractedAccountAndNext = section.split(''); + extractedAccountName = extractedAccountAndNext[0].split('')[1].split('')[0]; + } else if (!section.includes('@')) { //GNU social extractedAccountAndNext = section.split(''); extractedAccountName = extractedAccountAndNext[0].split('>')[1]; } else {