2023-07-27 05:31:52 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2019-01-29 04:46:24 +00:00
|
|
|
process.env.NODE_ENV = 'test';
|
|
|
|
|
2019-04-07 12:50:36 +00:00
|
|
|
import * as assert from 'assert';
|
2024-01-08 08:43:52 +00:00
|
|
|
import { api, post, signup } from '../utils.js';
|
2023-06-24 23:34:18 +00:00
|
|
|
import type * as misskey from 'misskey-js';
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
describe('API visibility', () => {
|
2022-09-17 18:27:08 +00:00
|
|
|
describe('Note visibility', () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
//#region vars
|
|
|
|
/** ヒロイン */
|
2024-01-03 04:41:28 +00:00
|
|
|
let alice: misskey.entities.SignupResponse;
|
2019-01-29 04:46:24 +00:00
|
|
|
/** フォロワー */
|
2024-01-03 04:41:28 +00:00
|
|
|
let follower: misskey.entities.SignupResponse;
|
2019-01-29 04:46:24 +00:00
|
|
|
/** 非フォロワー */
|
2024-01-03 04:41:28 +00:00
|
|
|
let other: misskey.entities.SignupResponse;
|
2019-01-29 04:46:24 +00:00
|
|
|
/** 非フォロワーでもリプライやメンションをされた人 */
|
2024-01-03 04:41:28 +00:00
|
|
|
let target: misskey.entities.SignupResponse;
|
2020-01-09 05:35:04 +00:00
|
|
|
/** specified mentionでmentionを飛ばされる人 */
|
2024-01-03 04:41:28 +00:00
|
|
|
let target2: misskey.entities.SignupResponse;
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
/** public-post */
|
|
|
|
let pub: any;
|
|
|
|
/** home-post */
|
|
|
|
let home: any;
|
|
|
|
/** followers-post */
|
|
|
|
let fol: any;
|
|
|
|
/** specified-post */
|
|
|
|
let spe: any;
|
|
|
|
|
|
|
|
/** public-reply to target's post */
|
|
|
|
let pubR: any;
|
|
|
|
/** home-reply to target's post */
|
|
|
|
let homeR: any;
|
|
|
|
/** followers-reply to target's post */
|
|
|
|
let folR: any;
|
|
|
|
/** specified-reply to target's post */
|
|
|
|
let speR: any;
|
|
|
|
|
|
|
|
/** public-mention to target */
|
|
|
|
let pubM: any;
|
|
|
|
/** home-mention to target */
|
|
|
|
let homeM: any;
|
|
|
|
/** followers-mention to target */
|
|
|
|
let folM: any;
|
|
|
|
/** specified-mention to target */
|
|
|
|
let speM: any;
|
|
|
|
|
|
|
|
/** reply target post */
|
|
|
|
let tgt: any;
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
const show = async (noteId: any, by: any) => {
|
2023-03-03 02:13:12 +00:00
|
|
|
return await api('/notes/show', {
|
2022-05-21 13:21:41 +00:00
|
|
|
noteId,
|
2019-01-29 04:46:24 +00:00
|
|
|
}, by);
|
|
|
|
};
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
beforeAll(async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
//#region prepare
|
|
|
|
// signup
|
2022-05-21 13:21:41 +00:00
|
|
|
alice = await signup({ username: 'alice' });
|
2019-01-29 04:46:24 +00:00
|
|
|
follower = await signup({ username: 'follower' });
|
2022-05-21 13:21:41 +00:00
|
|
|
other = await signup({ username: 'other' });
|
|
|
|
target = await signup({ username: 'target' });
|
|
|
|
target2 = await signup({ username: 'target2' });
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// follow alice <= follower
|
2023-03-03 02:13:12 +00:00
|
|
|
await api('/following/create', { userId: alice.id }, follower);
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// normal posts
|
2022-05-21 13:21:41 +00:00
|
|
|
pub = await post(alice, { text: 'x', visibility: 'public' });
|
2019-01-29 04:46:24 +00:00
|
|
|
home = await post(alice, { text: 'x', visibility: 'home' });
|
2022-05-21 13:21:41 +00:00
|
|
|
fol = await post(alice, { text: 'x', visibility: 'followers' });
|
|
|
|
spe = await post(alice, { text: 'x', visibility: 'specified', visibleUserIds: [target.id] });
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// replies
|
|
|
|
tgt = await post(target, { text: 'y', visibility: 'public' });
|
2022-05-21 13:21:41 +00:00
|
|
|
pubR = await post(alice, { text: 'x', replyId: tgt.id, visibility: 'public' });
|
2019-01-29 04:46:24 +00:00
|
|
|
homeR = await post(alice, { text: 'x', replyId: tgt.id, visibility: 'home' });
|
2022-05-21 13:21:41 +00:00
|
|
|
folR = await post(alice, { text: 'x', replyId: tgt.id, visibility: 'followers' });
|
|
|
|
speR = await post(alice, { text: 'x', replyId: tgt.id, visibility: 'specified' });
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// mentions
|
2022-05-21 13:21:41 +00:00
|
|
|
pubM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'public' });
|
2019-01-29 04:46:24 +00:00
|
|
|
homeM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'home' });
|
2022-05-21 13:21:41 +00:00
|
|
|
folM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'followers' });
|
|
|
|
speM = await post(alice, { text: '@target2 x', replyId: tgt.id, visibility: 'specified' });
|
2019-01-29 04:46:24 +00:00
|
|
|
//#endregion
|
|
|
|
});
|
|
|
|
|
|
|
|
//#region show post
|
|
|
|
// public
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-postを自分が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pub.id, alice);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-postをフォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pub.id, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-postを非フォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pub.id, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-postを未認証が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pub.id, null);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// home
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-postを自分が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(home.id, alice);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-postをフォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(home.id, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-postを非フォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(home.id, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-postを未認証が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(home.id, null);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// followers
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-postを自分が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(fol.id, alice);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-postをフォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(fol.id, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-postを非フォロワーが見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(fol.id, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-postを未認証が見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(fol.id, null);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// specified
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-postを自分が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(spe.id, alice);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-postを指定ユーザーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(spe.id, target);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-postをフォロワーが見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(spe.id, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-postを非フォロワーが見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(spe.id, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-postを未認証が見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(spe.id, null);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region show reply
|
|
|
|
// public
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-replyを自分が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pubR.id, alice);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-replyをされた人が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pubR.id, target);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-replyをフォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pubR.id, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-replyを非フォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pubR.id, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-replyを未認証が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pubR.id, null);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// home
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-replyを自分が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(homeR.id, alice);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-replyをされた人が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(homeR.id, target);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-replyをフォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(homeR.id, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-replyを非フォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(homeR.id, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-replyを未認証が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(homeR.id, null);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// followers
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-replyを自分が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(folR.id, alice);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-replyを非フォロワーでもリプライされていれば見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(folR.id, target);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-replyをフォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(folR.id, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-replyを非フォロワーが見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(folR.id, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-replyを未認証が見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(folR.id, null);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// specified
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-replyを自分が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(speR.id, alice);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-replyを指定ユーザーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(speR.id, target);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-replyをされた人が指定されてなくても見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(speR.id, target);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-replyをフォロワーが見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(speR.id, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-replyを非フォロワーが見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(speR.id, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-replyを未認証が見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(speR.id, null);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region show mention
|
|
|
|
// public
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-mentionを自分が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pubM.id, alice);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-mentionをされた人が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pubM.id, target);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-mentionをフォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pubM.id, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-mentionを非フォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pubM.id, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] public-mentionを未認証が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(pubM.id, null);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// home
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-mentionを自分が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(homeM.id, alice);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-mentionをされた人が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(homeM.id, target);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-mentionをフォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(homeM.id, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-mentionを非フォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(homeM.id, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] home-mentionを未認証が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(homeM.id, null);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// followers
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-mentionを自分が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(folM.id, alice);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-mentionをメンションされていれば非フォロワーでも見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(folM.id, target);
|
2020-01-09 05:35:04 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-mentionをフォロワーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(folM.id, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-mentionを非フォロワーが見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(folM.id, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] followers-mentionを未認証が見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(folM.id, null);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
|
|
|
// specified
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-mentionを自分が見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(speM.id, alice);
|
2020-01-09 05:35:04 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target2 x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-mentionを指定ユーザーが見れる', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(speM.id, target);
|
2020-01-09 05:35:04 +00:00
|
|
|
assert.strictEqual(res.body.text, '@target2 x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-mentionをされた人が指定されてなかったら見れない', async () => {
|
2020-01-09 05:35:04 +00:00
|
|
|
const res = await show(speM.id, target2);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-mentionをフォロワーが見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(speM.id, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-mentionを非フォロワーが見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(speM.id, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[show] specified-mentionを未認証が見れない', async () => {
|
2019-01-29 04:46:24 +00:00
|
|
|
const res = await show(speM.id, null);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.body.isHidden, true);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region HTL
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[HTL] public-post が 自分が見れる', async () => {
|
2023-03-03 02:13:12 +00:00
|
|
|
const res = await api('/notes/timeline', { limit: 100 }, alice);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.status, 200);
|
2022-09-17 18:27:08 +00:00
|
|
|
const notes = res.body.filter((n: any) => n.id === pub.id);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(notes[0].text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[HTL] public-post が 非フォロワーから見れない', async () => {
|
2023-03-03 02:13:12 +00:00
|
|
|
const res = await api('/notes/timeline', { limit: 100 }, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.status, 200);
|
2022-09-17 18:27:08 +00:00
|
|
|
const notes = res.body.filter((n: any) => n.id === pub.id);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(notes.length, 0);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[HTL] followers-post が フォロワーから見れる', async () => {
|
2023-03-03 02:13:12 +00:00
|
|
|
const res = await api('/notes/timeline', { limit: 100 }, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.status, 200);
|
2022-09-17 18:27:08 +00:00
|
|
|
const notes = res.body.filter((n: any) => n.id === fol.id);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(notes[0].text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region RTL
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[replies] followers-reply が フォロワーから見れる', async () => {
|
2023-03-03 02:13:12 +00:00
|
|
|
const res = await api('/notes/replies', { noteId: tgt.id, limit: 100 }, follower);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.status, 200);
|
2022-09-17 18:27:08 +00:00
|
|
|
const notes = res.body.filter((n: any) => n.id === folR.id);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(notes[0].text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[replies] followers-reply が 非フォロワー (リプライ先ではない) から見れない', async () => {
|
2023-03-03 02:13:12 +00:00
|
|
|
const res = await api('/notes/replies', { noteId: tgt.id, limit: 100 }, other);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.status, 200);
|
2022-09-17 18:27:08 +00:00
|
|
|
const notes = res.body.filter((n: any) => n.id === folR.id);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(notes.length, 0);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[replies] followers-reply が 非フォロワー (リプライ先である) から見れる', async () => {
|
2023-03-03 02:13:12 +00:00
|
|
|
const res = await api('/notes/replies', { noteId: tgt.id, limit: 100 }, target);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.status, 200);
|
2022-09-17 18:27:08 +00:00
|
|
|
const notes = res.body.filter((n: any) => n.id === folR.id);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(notes[0].text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 08:34:43 +00:00
|
|
|
//#endregion
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2019-01-29 08:34:43 +00:00
|
|
|
//#region MTL
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[mentions] followers-reply が 非フォロワー (リプライ先である) から見れる', async () => {
|
2023-03-03 02:13:12 +00:00
|
|
|
const res = await api('/notes/mentions', { limit: 100 }, target);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.status, 200);
|
2022-09-17 18:27:08 +00:00
|
|
|
const notes = res.body.filter((n: any) => n.id === folR.id);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(notes[0].text, 'x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
|
2023-02-02 09:18:25 +00:00
|
|
|
test('[mentions] followers-mention が 非フォロワー (メンション先である) から見れる', async () => {
|
2023-03-03 02:13:12 +00:00
|
|
|
const res = await api('/notes/mentions', { limit: 100 }, target);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(res.status, 200);
|
2022-09-17 18:27:08 +00:00
|
|
|
const notes = res.body.filter((n: any) => n.id === folM.id);
|
2019-04-07 12:50:36 +00:00
|
|
|
assert.strictEqual(notes[0].text, '@target x');
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
2019-01-29 04:46:24 +00:00
|
|
|
//#endregion
|
|
|
|
});
|
|
|
|
});
|
2023-03-03 02:13:12 +00:00
|
|
|
|