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: 複数idを指定するusers/showが関係ないユーザを返すことがある問題を修正 #13765

Merged
merged 6 commits into from
May 20, 2024

Conversation

anatawa12
Copy link
Member

What

  • 存在しないユーザー(削除済み等で発生し得る?)のIDをusers/showのuserIdsに入れてリクエストすると、関係ないユーザーの情報が返ってくるAPIのバグがあることを発見
    • 関係ないユーザーが宛先に含まれてしまう問題を引き起こす可能性があります

#13717 (comment) の修正です。

Why

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 packages/frontend Client side specific issue/PR packages/backend Server side specific issue/PR packages/misskey-js labels Apr 29, 2024
@anatawa12
Copy link
Member Author

nullable arrayにするかは悩みましたがAPIの仕様がsetではなくarrayっぽいので複数のユーザをまとめてアクセスするのを最適化するのに使えるように設計されてたのでnullable arrayにしました

Copy link

codecov bot commented Apr 29, 2024

Codecov Report

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

Project coverage is 65.15%. Comparing base (f6df940) to head (af6cc7f).
Report is 1 commits behind head on develop.

Current head af6cc7f differs from pull request most recent head a35dc9f

Please upload reports for the commit a35dc9f to get more accurate results.

Files Patch % Lines
...ges/backend/src/server/api/endpoints/users/show.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #13765      +/-   ##
===========================================
- Coverage    66.46%   65.15%   -1.31%     
===========================================
  Files          988      985       -3     
  Lines       116719   112117    -4602     
  Branches      4511     4422      -89     
===========================================
- Hits         77572    73054    -4518     
+ Misses       39116    39032      -84     
  Partials        31       31              

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

Copy link
Contributor

github-actions bot commented Apr 29, 2024

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

差分はこちら

Get diff files from Workflow Page

@syuilo
Copy link
Member

syuilo commented Apr 29, 2024

nullが入るとあらゆるところで判定が必要になるからnon-nullで良いと思った

@anatawa12
Copy link
Member Author

削除されてる等のときに別の処理したいことないですかね

@anatawa12
Copy link
Member Author

まぁidでマッチするようにすればいいからレスポンスのさぃず変えるようにしますか

@anatawa12
Copy link
Member Author

non-nullにしました

pushVisibleUser(users[i]);
}
}
users.forEach(pushVisibleUser);
Copy link
Member

Choose a reason for hiding this comment

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

関数そのまま渡すと型は同じまま引数変わった時にバグるわね

Copy link
Member Author

Choose a reason for hiding this comment

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

このファイル内で同様の処理が数多くあったのでそれに揃えたのですがそれらも同時にu => pushVisibleUserに治すということですかね

Copy link
Member

Choose a reason for hiding this comment

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

ついでにやっちゃってもらえると助かります🙏

@anatawa12
Copy link
Member Author

ごめんなさい。修正点あるの忘れてました。修正しました。マージターゲット修正したほうがいいですか

@anatawa12
Copy link
Member Author

conflict resolved

@syuilo syuilo merged commit 5836bd8 into misskey-dev:develop May 20, 2024
24 checks passed
@syuilo
Copy link
Member

syuilo commented May 20, 2024

🙏

@anatawa12 anatawa12 deleted the fix-user-show-multiple branch May 20, 2024 11:58
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 packages/frontend Client side specific issue/PR packages/misskey-js:test packages/misskey-js
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants