mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-12-22 00:10:14 +00:00
* Update CHANGELOG.md * fix : able to search all channels * add chennel/search test * update Changelog --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> Co-authored-by: atsuchan <83960488+atsu1125@users.noreply.github.com> Co-authored-by: Masaya Suzuki <15100604+massongit@users.noreply.github.com> Co-authored-by: Kagami Sascha Rosylight <saschanaz@outlook.com> Co-authored-by: taiy <53635909+taiyme@users.noreply.github.com> Co-authored-by: xianon <xianon@hotmail.co.jp> Co-authored-by: kabo2468 <28654659+kabo2468@users.noreply.github.com> Co-authored-by: YS <47836716+yszkst@users.noreply.github.com> Co-authored-by: Khsmty <me@khsmty.com> Co-authored-by: Soni L <EnderMoneyMod@gmail.com> Co-authored-by: mei23 <m@m544.net> Co-authored-by: daima3629 <52790780+daima3629@users.noreply.github.com> Co-authored-by: Windymelt <1113940+windymelt@users.noreply.github.com> Co-authored-by: Ebise Lutica <7106976+EbiseLutica@users.noreply.github.com>
This commit is contained in:
parent
8c70bbe74d
commit
8dab46470e
4 changed files with 106 additions and 8 deletions
|
@ -33,6 +33,7 @@
|
|||
- Fix: フォローリクエストの通知が残る問題を修正
|
||||
|
||||
### Client
|
||||
- チャンネル検索ですべてのチャンネルの取得/表示ができるように
|
||||
- 通知の表示をカスタマイズできるように
|
||||
- コントロールパネルのカスタム絵文字ページおよびaboutのカスタム絵文字の検索インプットで、`:emojiname1::emojiname2:`のように検索して絵文字を検索できるように
|
||||
* 絵文字ピッカーから入力可能になります
|
||||
|
@ -46,6 +47,7 @@
|
|||
- ドライブのファイル一覧から直接ノートを作成できるように
|
||||
|
||||
### Server
|
||||
- channel/searchのqueryが空の場合に全てのチャンネルを返すように変更
|
||||
- 環境変数MISSKEY_CONFIG_YMLで設定ファイルをdefault.ymlから変更可能に
|
||||
- Fix: 他のサーバーの情報が取得できないことがある問題を修正
|
||||
- Fix: エクスポートデータの拡張子がunknownになる問題を修正
|
||||
|
|
|
@ -48,13 +48,15 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
super(meta, paramDef, async (ps, me) => {
|
||||
const query = this.queryService.makePaginationQuery(this.channelsRepository.createQueryBuilder('channel'), ps.sinceId, ps.untilId);
|
||||
|
||||
if (ps.type === 'nameAndDescription') {
|
||||
query.andWhere(new Brackets(qb => { qb
|
||||
.where('channel.name ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` })
|
||||
.orWhere('channel.description ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` });
|
||||
}));
|
||||
} else {
|
||||
query.andWhere('channel.name ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` });
|
||||
if (ps.query !== '') {
|
||||
if (ps.type === 'nameAndDescription') {
|
||||
query.andWhere(new Brackets(qb => { qb
|
||||
.where('channel.name ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` })
|
||||
.orWhere('channel.description ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` });
|
||||
}));
|
||||
} else {
|
||||
query.andWhere('channel.name ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` });
|
||||
}
|
||||
}
|
||||
|
||||
const channels = await query
|
||||
|
|
|
@ -403,6 +403,100 @@ describe('Endpoints', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('channels/search', () => {
|
||||
test('空白検索で一覧を取得できる', async () => {
|
||||
await api('/channels/create', {
|
||||
name: 'aaa',
|
||||
description: 'bbb',
|
||||
}, bob);
|
||||
await api('/channels/create', {
|
||||
name: 'ccc1',
|
||||
description: 'ddd1',
|
||||
}, bob);
|
||||
await api('/channels/create', {
|
||||
name: 'ccc2',
|
||||
description: 'ddd2',
|
||||
}, bob);
|
||||
|
||||
const res = await api('/channels/search', {
|
||||
query: '',
|
||||
}, bob);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(typeof res.body === 'object' && Array.isArray(res.body), true);
|
||||
assert.strictEqual(res.body.length, 3);
|
||||
});
|
||||
test('名前のみの検索で名前を検索できる', async () => {
|
||||
const res = await api('/channels/search', {
|
||||
query: 'aaa',
|
||||
type: 'nameOnly',
|
||||
}, bob);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(typeof res.body === 'object' && Array.isArray(res.body), true);
|
||||
assert.strictEqual(res.body.length, 1);
|
||||
assert.strictEqual(res.body[0].name, 'aaa');
|
||||
});
|
||||
test('名前のみの検索で名前を複数検索できる', async () => {
|
||||
const res = await api('/channels/search', {
|
||||
query: 'ccc',
|
||||
type: 'nameOnly',
|
||||
}, bob);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(typeof res.body === 'object' && Array.isArray(res.body), true);
|
||||
assert.strictEqual(res.body.length, 2);
|
||||
});
|
||||
test('名前のみの検索で説明は検索できない', async () => {
|
||||
const res = await api('/channels/search', {
|
||||
query: 'bbb',
|
||||
type: 'nameOnly',
|
||||
}, bob);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(typeof res.body === 'object' && Array.isArray(res.body), true);
|
||||
assert.strictEqual(res.body.length, 0);
|
||||
});
|
||||
test('名前と説明の検索で名前を検索できる', async () => {
|
||||
const res = await api('/channels/search', {
|
||||
query: 'ccc1',
|
||||
}, bob);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(typeof res.body === 'object' && Array.isArray(res.body), true);
|
||||
assert.strictEqual(res.body.length, 1);
|
||||
assert.strictEqual(res.body[0].name, 'ccc1');
|
||||
});
|
||||
test('名前と説明での検索で説明を検索できる', async () => {
|
||||
const res = await api('/channels/search', {
|
||||
query: 'ddd1',
|
||||
}, bob);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(typeof res.body === 'object' && Array.isArray(res.body), true);
|
||||
assert.strictEqual(res.body.length, 1);
|
||||
assert.strictEqual(res.body[0].name, 'ccc1');
|
||||
});
|
||||
test('名前と説明の検索で名前を複数検索できる', async () => {
|
||||
const res = await api('/channels/search', {
|
||||
query: 'ccc',
|
||||
}, bob);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(typeof res.body === 'object' && Array.isArray(res.body), true);
|
||||
assert.strictEqual(res.body.length, 2);
|
||||
});
|
||||
test('名前と説明での検索で説明を複数検索できる', async () => {
|
||||
const res = await api('/channels/search', {
|
||||
query: 'ddd',
|
||||
}, bob);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(typeof res.body === 'object' && Array.isArray(res.body), true);
|
||||
assert.strictEqual(res.body.length, 2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('drive', () => {
|
||||
test('ドライブ情報を取得できる', async () => {
|
||||
await uploadFile(alice, {
|
||||
|
|
|
@ -96,7 +96,7 @@ const ownedPagination = {
|
|||
async function search() {
|
||||
const query = searchQuery.toString().trim();
|
||||
|
||||
if (query == null || query === '') return;
|
||||
if (query == null) return;
|
||||
|
||||
const type = searchType.toString().trim();
|
||||
|
||||
|
|
Loading…
Reference in a new issue