非ASCIIなドメインへのメンションの修正 (#2903)
* punycodeでされたmentionのラベルをunicodeとして表示する * post-form mentionはpunycodeにする * mentionの表示はURLもAPI向けもunicodeにする
This commit is contained in:
parent
be82d845a4
commit
5dce81c0db
6 changed files with 27 additions and 13 deletions
16
test/mfm.ts
16
test/mfm.ts
|
@ -8,9 +8,9 @@ describe('Text', () => {
|
|||
it('can be analyzed', () => {
|
||||
const tokens = analyze('@himawari @hima_sub@namori.net お腹ペコい :cat: #yryr');
|
||||
assert.deepEqual([
|
||||
{ type: 'mention', content: '@himawari', username: 'himawari', host: null },
|
||||
{ type: 'mention', content: '@himawari', canonical: '@himawari', username: 'himawari', host: null },
|
||||
{ type: 'text', content: ' '},
|
||||
{ type: 'mention', content: '@hima_sub@namori.net', username: 'hima_sub', host: 'namori.net' },
|
||||
{ type: 'mention', content: '@hima_sub@namori.net', canonical: '@hima_sub@namori.net', username: 'hima_sub', host: 'namori.net' },
|
||||
{ type: 'text', content: ' お腹ペコい ' },
|
||||
{ type: 'emoji', content: ':cat:', emoji: 'cat'},
|
||||
{ type: 'text', content: ' '},
|
||||
|
@ -58,7 +58,7 @@ describe('Text', () => {
|
|||
it('local', () => {
|
||||
const tokens = analyze('@himawari お腹ペコい');
|
||||
assert.deepEqual([
|
||||
{ type: 'mention', content: '@himawari', username: 'himawari', host: null },
|
||||
{ type: 'mention', content: '@himawari', canonical: '@himawari', username: 'himawari', host: null },
|
||||
{ type: 'text', content: ' お腹ペコい' }
|
||||
], tokens);
|
||||
});
|
||||
|
@ -66,7 +66,15 @@ describe('Text', () => {
|
|||
it('remote', () => {
|
||||
const tokens = analyze('@hima_sub@namori.net お腹ペコい');
|
||||
assert.deepEqual([
|
||||
{ type: 'mention', content: '@hima_sub@namori.net', username: 'hima_sub', host: 'namori.net' },
|
||||
{ type: 'mention', content: '@hima_sub@namori.net', canonical: '@hima_sub@namori.net', username: 'hima_sub', host: 'namori.net' },
|
||||
{ type: 'text', content: ' お腹ペコい' }
|
||||
], tokens);
|
||||
});
|
||||
|
||||
it('remote punycode', () => {
|
||||
const tokens = analyze('@hima_sub@xn--q9j5bya.xn--zckzah お腹ペコい');
|
||||
assert.deepEqual([
|
||||
{ type: 'mention', content: '@hima_sub@xn--q9j5bya.xn--zckzah', canonical: '@hima_sub@なもり.テスト', username: 'hima_sub', host: 'xn--q9j5bya.xn--zckzah' },
|
||||
{ type: 'text', content: ' お腹ペコい' }
|
||||
], tokens);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue