Skip to content

Conversation

@kakkokari-gtyih
Copy link
Contributor

@kakkokari-gtyih kakkokari-gtyih commented Dec 14, 2025

What

可読性の向上

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

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 14, 2025
@github-actions github-actions bot added the packages/frontend Client side specific issue/PR label Dec 14, 2025
@codecov
Copy link

codecov bot commented Dec 14, 2025

Codecov Report

❌ Patch coverage is 9.47368% with 86 lines in your changes missing coverage. Please review.
✅ Project coverage is 14.01%. Comparing base (78435dc) to head (570cb53).
⚠️ Report is 12 commits behind head on develop.

Files with missing lines Patch % Lines
packages/frontend/src/utility/sound.ts 8.98% 60 Missing and 21 partials ⚠️
...tend/src/components/MkReactionsViewer.reaction.vue 0.00% 2 Missing ⚠️
...ontend/src/components/MkStreamingNotesTimeline.vue 0.00% 1 Missing and 1 partial ⚠️
packages/frontend/src/components/MkNote.vue 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #16990      +/-   ##
===========================================
+ Coverage    13.97%   14.01%   +0.04%     
===========================================
  Files          237      238       +1     
  Lines        11273    11289      +16     
  Branches      3728     3734       +6     
===========================================
+ Hits          1575     1582       +7     
- Misses        7578     7586       +8     
- Partials      2120     2121       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Dec 14, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the frontend sound playback system by converting function-based utilities to a class-based SoundManager approach. The refactoring improves code organization and maintainability while preserving all existing functionality.

Key changes:

  • Converted standalone sound utility functions to a SoundManager class with instance methods
  • Created a singleton soundManager instance exported from @/sound.js
  • Updated API property names (soundSourcesourceNode) and method names (playMisskeySfxplaySfx, playMisskeySfxFileplaySfxFile, getSoundDurationgetDuration)

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/frontend/src/utility/sound.ts Complete refactoring: converted standalone functions to SoundManager class, improved type organization, added defensive _DEV_ check
packages/frontend/src/sound.ts New file exporting singleton soundManager instance
packages/frontend/src/widgets/WidgetJobQueue.vue Updated to use soundManager instance and new sourceNode property name
packages/frontend/src/ui/deck/tl-note-notification.ts Updated to use soundManager.getDuration() and soundManager.playSfxFile()
packages/frontend/src/ui/common/common.vue Updated to use soundManager.playSfx()
packages/frontend/src/pages/settings/sounds.sound.vue Updated to use soundManager.getDuration() and soundManager.playSfxFile()
packages/frontend/src/pages/reversi/index.vue Updated to use soundManager.playUrl()
packages/frontend/src/pages/reversi/game.board.vue Updated to use soundManager.playUrl()
packages/frontend/src/pages/drop-and-fusion.game.vue Updated to use soundManager methods and new sourceNode property name
packages/frontend/src/pages/chat/room.vue Updated to use soundManager.playSfx()
packages/frontend/src/pages/chat/XMessage.vue Updated to use soundManager.playSfx()
packages/frontend/src/components/MkStreamingNotesTimeline.vue Updated to use soundManager.playSfxFile() and soundManager.playSfx()
packages/frontend/src/components/MkReactionsViewer.reaction.vue Updated to use soundManager.playSfx()
packages/frontend/src/components/MkNoteDetailed.vue Updated to use soundManager.playSfx()
packages/frontend/src/components/MkNote.vue Updated to use soundManager.playSfx()
packages/frontend/src/boot/main-boot.ts Updated to use soundManager.playSfx()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* 直接URLを指定して再生
*/
public async playUrl(url: string, opts: AudioOptions) {
if (opts.volume === 0) return;
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

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

The volume check should also handle undefined values. Currently, if opts.volume is undefined, the check opts.volume === 0 will be false, allowing execution to continue. While all current call sites provide a volume value, this could lead to unexpected behavior if the method is called without a volume parameter in the future. Consider changing to if (opts.volume === 0 || opts.volume === undefined) or if (!opts.volume) to be more defensive.

Suggested change
if (opts.volume === 0) return;
if (opts.volume === 0 || opts.volume === undefined) return;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages/frontend Client side specific issue/PR size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Development

Successfully merging this pull request may close these issues.

1 participant