-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fefa671
commit c7a9b5d
Showing
4 changed files
with
134 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3384,3 +3384,4 @@ _emoji: | |
allow: "許可" | ||
deny: "禁止" | ||
conditional: "条件付き" | ||
isBasedOn: "絵文字ベース" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,7 +210,7 @@ describe('Emoji', () => { | |
credentials: 'omit', | ||
cache: 'no-cache', | ||
}); | ||
console.log(await res.json()); | ||
strictEqual((await res.json()).code, 'NOT_ALLOWED') | ||
}); | ||
test('コピー拒否の絵文字をコピーできない(steal)', async () => { | ||
const emoji = await addCustomEmoji('a.test', { | ||
|
@@ -246,7 +246,7 @@ describe('Emoji', () => { | |
credentials: 'omit', | ||
cache: 'no-cache', | ||
}); | ||
console.log(await res.json()); | ||
strictEqual((await res.json()).code, 'NOT_ALLOWED') | ||
}); | ||
|
||
test('コピー許可の絵文字をコピーできる(copy)', async () => { | ||
|
@@ -331,7 +331,8 @@ describe('Emoji', () => { | |
isBasedOn: 'isBasedOn', | ||
}), JSON.stringify(res)); | ||
}); | ||
test('条件付きの絵文字をコピーできない', async () => { | ||
|
||
test('条件付きの絵文字をコピーできない(copy)', async () => { | ||
const emoji = await addCustomEmoji('a.test', { | ||
aliases: ['a', 'b', 'c'], | ||
license: 'license', | ||
|
@@ -367,7 +368,125 @@ describe('Emoji', () => { | |
credentials: 'omit', | ||
cache: 'no-cache', | ||
}); | ||
console.log(await res.json()); | ||
strictEqual((await res.json()).code, 'SEE_USAGEINFOMATION_OR_LICENSE') | ||
strictEqual((await res.json()).code, 'SEE_USAGEINFOMATION_OR_LICENSE') | ||
}); | ||
test('条件付きの絵文字をコピーできない(steal)', async () => { | ||
const emoji = await addCustomEmoji('a.test', { | ||
aliases: ['a', 'b', 'c'], | ||
license: 'license', | ||
category: 'category', | ||
copyPermission: 'conditional', | ||
usageInfo: 'usageInfo', | ||
author: '@[email protected]', | ||
description: 'description', | ||
isBasedOn: 'isBasedOn', | ||
}); | ||
await alice.client.request('notes/create', { text: `I love :${emoji.name}:` }); | ||
await sleep(); | ||
|
||
const notes = await bob.client.request('notes/timeline', {}); | ||
const noteInB = notes[0]; | ||
|
||
strictEqual(noteInB.text, `I love \u200b:${emoji.name}:\u200b`); | ||
assert(noteInB.emojis != null); | ||
assert(emoji.name in noteInB.emojis); | ||
strictEqual(noteInB.emojis[emoji.name], emoji.url); | ||
let res = await fetch(`https://b.test/api/admin/emoji/steal`, { | ||
method: 'POST', | ||
body: JSON.stringify({ | ||
name: emoji.name, | ||
host: 'a.test', | ||
i: bAdmin.client.credential, | ||
}), | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
credentials: 'omit', | ||
cache: 'no-cache', | ||
}); | ||
strictEqual((await res.json()).code, 'SEE_USAGEINFOMATION_OR_LICENSE') | ||
}); | ||
test('条件付きの絵文字をコピーできる(copy)', async () => { | ||
const emoji = await addCustomEmoji('a.test', { | ||
aliases: ['a', 'b', 'c'], | ||
license: 'license', | ||
category: 'category', | ||
copyPermission: 'allow', | ||
usageInfo: 'usageInfo', | ||
author: '@[email protected]', | ||
description: 'description', | ||
isBasedOn: 'isBasedOn', | ||
}); | ||
await alice.client.request('notes/create', { text: `I love :${emoji.name}:` }); | ||
await sleep(); | ||
|
||
const notes = await bob.client.request('notes/timeline', {}); | ||
const noteInB = notes[0]; | ||
|
||
strictEqual(noteInB.text, `I love \u200b:${emoji.name}:\u200b`); | ||
assert(noteInB.emojis != null); | ||
assert(emoji.name in noteInB.emojis); | ||
strictEqual(noteInB.emojis[emoji.name], emoji.url); | ||
// @ts-expect-error anyで警告が出るため | ||
const emojiId = (await bAdmin.client.request('admin/emoji/list-remote')).find( x => x.name === emoji.name).id; | ||
const res = await bAdmin.client.request('admin/emoji/copy', { emojiId: emojiId, usageInfoReaded: true }); | ||
strictEqual(JSON.stringify({ | ||
id: res.id, | ||
aliases: emoji.aliases, | ||
name: emoji.name, | ||
category: emoji.category, | ||
host: null, | ||
url: res.url, | ||
license: emoji.license, | ||
isSensitive: false, | ||
localOnly: false, | ||
roleIdsThatCanBeUsedThisEmojiAsReaction: [], | ||
copyPermission: emoji.copyPermission, | ||
usageInfo: emoji.usageInfo, | ||
author: emoji.author, | ||
description: emoji.description, | ||
isBasedOn: 'isBasedOn', | ||
}), JSON.stringify(res)); | ||
}); | ||
test('条件付きの絵文字をコピーできる(steal)', async () => { | ||
const emoji = await addCustomEmoji('a.test', { | ||
aliases: ['a', 'b', 'c'], | ||
license: 'license', | ||
category: 'category', | ||
copyPermission: 'allow', | ||
usageInfo: 'usageInfo', | ||
author: '@[email protected]', | ||
description: 'description', | ||
isBasedOn: 'isBasedOn', | ||
}); | ||
await alice.client.request('notes/create', { text: `I love :${emoji.name}:` }); | ||
await sleep(); | ||
|
||
const notes = await bob.client.request('notes/timeline', {}); | ||
const noteInB = notes[0]; | ||
|
||
strictEqual(noteInB.text, `I love \u200b:${emoji.name}:\u200b`); | ||
assert(noteInB.emojis != null); | ||
assert(emoji.name in noteInB.emojis); | ||
strictEqual(noteInB.emojis[emoji.name], emoji.url); | ||
const res = await bAdmin.client.request('admin/emoji/steal', { name: emoji.name, host: 'a.test', usageInfoReaded: true }); | ||
strictEqual(JSON.stringify({ | ||
id: res.id, | ||
aliases: emoji.aliases, | ||
name: emoji.name, | ||
category: emoji.category, | ||
host: null, | ||
url: res.url, | ||
license: emoji.license, | ||
isSensitive: false, | ||
localOnly: false, | ||
roleIdsThatCanBeUsedThisEmojiAsReaction: [], | ||
copyPermission: emoji.copyPermission, | ||
usageInfo: emoji.usageInfo, | ||
author: emoji.author, | ||
description: emoji.description, | ||
isBasedOn: 'isBasedOn', | ||
}), JSON.stringify(res)); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters