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

Only show audio message when track ID matches active #5305

Merged
merged 7 commits into from
Jan 16, 2025

Conversation

Anuj012004
Copy link
Contributor

@Anuj012004 Anuj012004 commented Dec 31, 2024

Fixes

Fixes #2202 by @obulat

Description

An audio-related error is observed across all audio cells in the content view. Specifically, all cells incorrectly display an error message regardless of their state. This occurs because the application does not validate whether the audio.id matches the activeMediaStore.id when setting the message. As a result, messages intended for the active audio track are incorrectly shown for all audio tracks.

Testing Instructions

A reliable way to test this behavior is to find .oga audio files in Safari.

  1. Run the app locally and go to http://localhost:8443/search/audio?q=cat&extension=oga
  2. Click on Play: you should see the error message only on the active track.
Screenshot 2025-01-16 at 1 26 59 PM

Compare with the same in production: you see that the error message is displayed on every track.
Screenshot 2025-01-16 at 1 27 33 PM

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (ov just catalog/generate-docs for catalog
    PRs) or the media properties generator (ov just catalog/generate-docs media-props
    for the catalog or ov just api/generate-docs for the API) where applicable.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@Anuj012004 Anuj012004 requested a review from a team as a code owner December 31, 2024 15:31
@Anuj012004 Anuj012004 requested review from obulat and dhruvkb December 31, 2024 15:31
@openverse-bot openverse-bot added 🧱 stack: frontend Related to the Nuxt frontend 🟨 priority: medium Not blocking but should be addressed soon 🛠 goal: fix Bug fix 🕹 aspect: interface Concerns end-users' experience with the software labels Dec 31, 2024
? t(`audioTrack.messages.${activeMediaStore.message}`)
const message = computed(() =>
activeMediaStore.id === props.audio.id && activeMediaStore.message
? i18n.t(`audioTrack.messages.${activeMediaStore.message}`).toString()
Copy link
Member

Choose a reason for hiding this comment

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

@obulat's comment #2202 (comment), although correct in terms of the changes, was a bit out of date. We can access t directly as it has been defined in line 70. Also there is no longer a need to use .toString().

Suggested change
? i18n.t(`audioTrack.messages.${activeMediaStore.message}`).toString()
? t(`audioTrack.messages.${activeMediaStore.message}`)

In fact, using i18n introduces an error because that's an undefined variable.

Error: frontend types: src/components/VAudioTrack/VAudioTrack.vue(301,7): error TS2304: Cannot find name 'i18n'.

frontend/src/components/VAudioTrack/VAudioTrack.vue Outdated Show resolved Hide resolved
@Anuj012004
Copy link
Contributor Author

Hey @dhruvkb,

I've updated the PR based on your suggestions:

1.Removed .toString() as it's no longer needed.
2.Using t directly since it's defined on line 70.
3.Fixed whitespace issues.

Please review and let me know if any other changes are needed. Thanks for the helpful feedback!

@Anuj012004
Copy link
Contributor Author

Hey @dhruvkb,

One check failed on my PR. Could you please take a look to help identify what needs to be fixed?
Thanks!

@dhruvkb
Copy link
Member

dhruvkb commented Jan 2, 2025

@Anuj012004 thanks for incorporating the feedback from the PR review. The changes in your PR are correct, and you might have noticed that the previously failing Lint check has passed. However the PR is failing the unit tests defined in the file frontend/test/unit/specs/components/AudioTrack/v-audio-track.spec.js. This means that the tests in that file have to be updated.

Now you would need to make changes to that file to rectify any incorrect test conditions, and run the tests locally with just frontend/run test:unit. Feel free to ask us if you need any help or assistance.

@Anuj012004
Copy link
Contributor Author

Hey @dhruvkb,
Please help me to fix the issue. I added test cases and due to my system's limitations I am unable to debug the failing tests effectively.

@openverse-bot
Copy link
Collaborator

Based on the contributor urgency of this PR, the following reviewers are being gently reminded to review this PR:

@obulat
This reminder is being automatically generated due to the urgency configuration.

Excluding weekend1 days, this PR was ready for review 4 day(s) ago. PRs labelled with contributor urgency are expected to be reviewed within 3 weekday(s)2.

@Anuj012004, if this PR is not ready for a review, please draft it to prevent reviewers from getting further unnecessary pings.

Footnotes

  1. Specifically, Saturday and Sunday.

  2. For the purpose of these reminders we treat Monday - Friday as weekdays. Please note that the operation that generates these reminders runs at midnight UTC on Monday - Friday. This means that depending on your timezone, you may be pinged outside of the expected range.

@Anuj012004 Anuj012004 marked this pull request as draft January 7, 2025 13:05
@obulat obulat force-pushed the fix/audio-error-content-view branch 2 times, most recently from 1aadf9d to a1fbb8d Compare January 16, 2025 10:05
@obulat obulat force-pushed the fix/audio-error-content-view branch from a1fbb8d to 4417e9f Compare January 16, 2025 10:18
@obulat obulat changed the title fix: only show audio message when track ID matches active Only show audio message when track ID matches active Jan 16, 2025
@obulat obulat marked this pull request as ready for review January 16, 2025 10:29
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution, @Anuj012004 !

I fixed the unit tests, and am going to merge this PR.

@obulat obulat dismissed dhruvkb’s stale review January 16, 2025 10:31

The requested changes have been added.

@obulat obulat merged commit caed135 into WordPress:main Jan 16, 2025
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕹 aspect: interface Concerns end-users' experience with the software 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: frontend Related to the Nuxt frontend
Projects
Status: 🤝 Merged
Development

Successfully merging this pull request may close these issues.

An audio error is shown on all of the Audio cells in all content view
4 participants