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