Skip to content
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

fix(backend): チャンネルフォロー一覧のsinceId/untilIdによる絞り込みが上手く動いていないのを修正 #13698

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

samunohito
Copy link
Member

@samunohito samunohito commented Apr 13, 2024

What

チャンネルのフォロー一覧を返すAPIにて、sinceId/untilIdの比較条件として与えているIDに間違いがあるのを直します(与えられているIDはchannel.idだが、比較先のIDはchannel_following.id)
これにより、チャンネルフォロー一覧から結果が抜け落ちる現象が改善されます。

Why

fix #12175

Additional info (optional)

実際にチャンネルを大量に作成&お気に入り登録し、歯抜けにならないことを確認。

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

@github-actions github-actions bot added the packages/backend Server side specific issue/PR label Apr 13, 2024
Copy link

codecov bot commented Apr 13, 2024

Codecov Report

Attention: Patch coverage is 3.12500% with 31 lines in your changes are missing coverage. Please review.

Project coverage is 64.94%. Comparing base (f5100cc) to head (58c56d9).

Files Patch % Lines
packages/backend/src/core/QueryService.ts 4.34% 22 Missing ⚠️
...kend/src/server/api/endpoints/channels/followed.ts 0.00% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #13698       +/-   ##
============================================
- Coverage    77.99%   64.94%   -13.06%     
============================================
  Files          185      986      +801     
  Lines        25454   111667    +86213     
  Branches       486     5703     +5217     
============================================
+ Hits         19853    72522    +52669     
- Misses        5594    37711    +32117     
- Partials         7     1434     +1427     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Apr 13, 2024

このPRによるapi.jsonの差分

差分はこちら

Get diff files from Workflow Page

q.orderBy(`${q.alias}.id`, 'DESC');
q.andWhere(`${q.alias}.${targetColumn} > :sinceId`, { sinceId: sinceId });
q.andWhere(`${q.alias}.${targetColumn} < :untilId`, { untilId: untilId });
q.orderBy(`${q.alias}.${targetColumn}`, 'DESC');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SELECT
    "MiChannelFollowing"."id" AS "MiChannelFollowing_id",
    "MiChannelFollowing"."followeeId" AS "MiChannelFollowing_followeeId",
    "MiChannelFollowing"."followerId" AS "MiChannelFollowing_followerId"
FROM
    "channel_following" "MiChannelFollowing"
WHERE
    "MiChannelFollowing"."followeeId" < $ 1
    AND "MiChannelFollowing"."followerId" = $ 2
ORDER BY
    "MiChannelFollowing"."followeeId" DESC
LIMIT
    30

↑のような感じで、外から任意のIDカラムを条件として使用できるようにしました。
省略時は従来通りidを使います

@samunohito samunohito marked this pull request as ready for review April 13, 2024 06:08
@syuilo
Copy link
Member

syuilo commented Apr 14, 2024

channel.idをIDとして与えている箇所って具体的にどこかしら?

@syuilo
Copy link
Member

syuilo commented Apr 14, 2024

見た感じバックエンドは現行の実装で何も問題なさそうだった

@samunohito
Copy link
Member Author

(いまコメントに気が付いた)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages/backend Server side specific issue/PR
Projects
None yet
2 participants