-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
フォロー中チャンネル一覧取得API(channels/followed)のuntilIdを設定すると想定通りの動作をしない #12175
Comments
以下の実装が噛み合っていないものと推測しています。
上記から、channel_following.idに対しsinceId/untilIdを使って絞り込みを測るも、channel.idとchannel_following.idは別物であるため意図せぬ動作をしているものと考えました。 |
以下のようにすればいけるかなと思ったのですが、如何でしょうか。 // 絞り込み対象とするカラムを外から設定できるようにする
// (他箇所に影響がないように元々固定で設定されていたidカラムをデフォルト値とする)
public makePaginationQuery<T extends ObjectLiteral>(
q: SelectQueryBuilder<T>,
sinceId?: string | null,
untilId?: string | null,
sinceDate?: number | null,
untilDate?: number | null,
columnName = 'id',
): SelectQueryBuilder<T> {
if (sinceId && untilId) {
q.andWhere(`${q.alias}.${columnName} > :sinceId`, { sinceId: sinceId });
q.andWhere(`${q.alias}.${columnName} < :untilId`, { untilId: untilId });
q.orderBy(`${q.alias}.${columnName}`, 'DESC');
} else if (sinceId) {
q.andWhere(`${q.alias}.${columnName} > :sinceId`, { sinceId: sinceId });
q.orderBy(`${q.alias}.${columnName}`, 'ASC');
} else if (untilId) {
q.andWhere(`${q.alias}.${columnName} < :untilId`, { untilId: untilId });
q.orderBy(`${q.alias}.${columnName}`, 'DESC');
.... // sinceId/untilIdと同種のfolloweeIdで絞り込めるようにカラム名を渡す
const query = this.queryService.makePaginationQuery(this.channelFollowingsRepository.createQueryBuilder(), ps.sinceId, ps.untilId, null, null, 'followeeId')
.andWhere({ followerId: me.id }); |
channels/followed でチャンネルではなく ChannelFollowing を返さないとダメそう |
となると…channelEntityService.pack()の流用はできなくなるので、channels/followed専用のものを新たに作成してそれを使うようにするイメージでしょうか(idはchannel_following.idを返すようにして、別にchannelIdみたいなパラメータを増やして返す) 上記方針だとフロント側やサードパーティアプリの該当機能も修正する必要が出てきますね… |
@syuilo |
v2として新設するとか |
これはバグの認識なので、仕様(channelのidを返す)を維持したまま期待動作になるよう修正するのがベストだと考えます。
|
ChannelFollowingを取得するAPIでChannelが返ってきてしまっているからいつフォローしたかとかの情報が取れない |
IDは日時情報入ってるわね |
ChannelFollowingに限らずMisskeyにおける全てのIDは日時情報がミリ秒単位で入っていてレスポンスのcreatedAtとかはそこから持ってきてる |
|
v2で新設すれば全てが解決すると思ったけど懸念あるかしら |
v2で新設というのは、ChannelFollowingのIDをベースにしたものを新しく作るという事ですか? |
そうね |
なるほど。v2を推される理由は理解しました。
#12175 (comment) |
ほむん |
実装できるならそれで良さそう |
💡 Summary
channels/followedはページネーションに対応しており、前回取得したチャンネル一覧のなかで最も古いチャンネルのIDをuntilIdに設定することで、数珠つなぎに一覧を取得する事ができる認識でおります。
しかし…いまは綺麗に数珠つなぎとならず、本来取得できるはずのチャンネルが結果に含まれないケースがありました。
検索タブでクエリを何も指定せずに検索してすべてのチャンネルを取得した状態です(こちらは意図通りに動いている)
テスト1~3のとおりの順番で作成しており、作成後にフォローもしていますのでchannels/followedの結果も同様になる想定でした。
しかし、フォロー中タブに遷移してスクロールすると、以下のようにテスト2チャンネルが抜けてしまっています。
テスト2チャンネルはフォロー済みです。
🥰 Expected Behavior
フォロー中のチャンネル一覧にすべての結果が表示される
🤬 Actual Behavior
一覧の中に含まれないチャンネルがある
📝 Steps to Reproduce
📌 Environment
💻 Frontend
🛰 Backend (for server admin)
The text was updated successfully, but these errors were encountered: