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: only show audio message when track ID matches active #5305

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Anuj012004
Copy link
Contributor

@Anuj012004 Anuj012004 commented Dec 31, 2024

Fixes #2202

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

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'.

Comment on lines 299 to 300
const message = computed(() =>
activeMediaStore.id === props.audio.id && activeMediaStore.message
Copy link
Member

Choose a reason for hiding this comment

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

Remove trailing spaces.

Tip

This can be done automatically by setting up the pre-commit and pre-push Git hooks > or by running ov just lint manually.

Suggested change
const message = computed(() =>
activeMediaStore.id === props.audio.id && activeMediaStore.message
const message = computed(() =>
activeMediaStore.id === props.audio.id && activeMediaStore.message

@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.

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: 🔁 Changes Requested
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
3 participants