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

Cleanup some duplicate channel tab URL handling code #3697

Merged
merged 2 commits into from
Jul 3, 2023

Conversation

absidue
Copy link
Member

@absidue absidue commented Jun 25, 2023

Cleanup some duplicate channel tab URL handling code

Pull Request Type

  • Refactor

Related issue

Noticed while working on #3689

Description

As we already removed hidden tabs from the tabInfoValues array, we can check if the tab in the link is in that array, instead of duplicating the same checks to other places in the code.

tabInfoValues:

tabInfoValues: function () {
const values = [
'videos',
'shorts',
'live',
'playlists',
'community',
'about'
]
// remove tabs from the array based on user settings
if (this.hideChannelShorts) {
const index = values.indexOf('shorts')
values.splice(index, 1)
}
if (this.hideLiveStreams) {
const index = values.indexOf('live')
values.splice(index, 1)
}
if (this.hideChannelPlaylists) {
const index = values.indexOf('playlists')
values.splice(index, 1)
}
if (this.hideChannelCommunity) {
const index = values.indexOf('community')
values.splice(index, 1)
}
return values
}

Testing

Try various channel links with tabs in them, to make sure they work correctly when tabs are hidden.

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) June 25, 2023 11:36
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Jun 25, 2023
PikachuEXE
PikachuEXE previously approved these changes Jun 25, 2023
Copy link
Collaborator

@PikachuEXE PikachuEXE left a comment

Choose a reason for hiding this comment

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

Maybe also eliminate this duplicate code part?

    let currentTab = this.$route.params.currentTab ?? 'videos'

    if (!this.tabInfoValues.includes(currentTab)) {
      currentTab = this.tabInfoValues[0]
    }

    this.currentTab = currentTab

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc added PR: changes requested and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Jun 29, 2023
@absidue absidue dismissed stale reviews from PikachuEXE and ChunkyProgrammer via 785184b July 1, 2023 14:44
@absidue absidue added PR: waiting for review For PRs that are complete, tested, and ready for review and removed PR: changes requested labels Jul 1, 2023
Copy link
Member

Choose a reason for hiding this comment

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

LGTM

@FreeTubeBot FreeTubeBot merged commit beaa9cc into FreeTubeApp:development Jul 3, 2023
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Jul 3, 2023
@absidue absidue deleted the cleanup-code branch July 3, 2023 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants