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

Distinguish destructive action fixes #5048

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/renderer/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
/>
<ft-button
:label="$t('Close')"
:text-color="null"
:background-color="null"
@click="showReleaseNotes = !showReleaseNotes"
/>
</ft-flex-box>
Expand Down
92 changes: 46 additions & 46 deletions src/renderer/components/playlist-info/playlist-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ export default defineComponent({
newTitle: '',
newDescription: '',
deletePlaylistPromptValues: [
'yes',
'no'
'delete',
'cancel'
],
}
},
Expand Down Expand Up @@ -157,8 +157,8 @@ export default defineComponent({

deletePlaylistPromptNames: function () {
return [
this.$t('Yes'),
this.$t('No')
this.$t('Yes, Delete'),
this.$t('Cancel')
]
},

Expand Down Expand Up @@ -326,56 +326,56 @@ export default defineComponent({
},

handleRemoveVideosOnWatchPromptAnswer: function (option) {
if (option === 'yes') {
const videosToWatch = this.selectedUserPlaylist.videos.filter((video) => {
return this.historyCacheById[video.videoId] == null
})
this.showRemoveVideosOnWatchPrompt = false
if (option !== 'delete') { return }

const removedVideosCount = this.selectedUserPlaylist.videos.length - videosToWatch.length
const videosToWatch = this.selectedUserPlaylist.videos.filter((video) => {
return this.historyCacheById[video.videoId] == null
})

if (removedVideosCount === 0) {
showToast(this.$t('User Playlists.SinglePlaylistView.Toast["There were no videos to remove."]'))
this.showRemoveVideosOnWatchPrompt = false
return
}
const removedVideosCount = this.selectedUserPlaylist.videos.length - videosToWatch.length

const playlist = {
playlistName: this.title,
protected: this.selectedUserPlaylist.protected,
description: this.description,
videos: videosToWatch,
_id: this.id
}
try {
this.updatePlaylist(playlist)
showToast(this.$tc('User Playlists.SinglePlaylistView.Toast.{videoCount} video(s) have been removed', removedVideosCount, {
videoCount: removedVideosCount,
}))
} catch (e) {
showToast(this.$t('User Playlists.SinglePlaylistView.Toast["There was an issue with updating this playlist."]'))
console.error(e)
}
if (removedVideosCount === 0) {
showToast(this.$t('User Playlists.SinglePlaylistView.Toast["There were no videos to remove."]'))
this.showRemoveVideosOnWatchPrompt = false
return
}

const playlist = {
playlistName: this.title,
protected: this.selectedUserPlaylist.protected,
description: this.description,
videos: videosToWatch,
_id: this.id
}
try {
this.updatePlaylist(playlist)
showToast(this.$tc('User Playlists.SinglePlaylistView.Toast.{videoCount} video(s) have been removed', removedVideosCount, {
videoCount: removedVideosCount,
}))
} catch (e) {
showToast(this.$t('User Playlists.SinglePlaylistView.Toast["There was an issue with updating this playlist."]'))
console.error(e)
}
this.showRemoveVideosOnWatchPrompt = false
},

handleDeletePlaylistPromptAnswer: function (option) {
if (option === 'yes') {
if (this.selectedUserPlaylist.protected) {
showToast(this.$t('User Playlists.SinglePlaylistView.Toast["This playlist is protected and cannot be removed."]'))
} else {
this.removePlaylist(this.id)
this.$router.push(
{
path: '/userPlaylists'
}
)
showToast(this.$t('User Playlists.SinglePlaylistView.Toast["Playlist {playlistName} has been deleted."]', {
playlistName: this.title,
}))
}
}
this.showDeletePlaylistPrompt = false
if (option !== 'delete') { return }

if (this.selectedUserPlaylist.protected) {
showToast(this.$t('User Playlists.SinglePlaylistView.Toast["This playlist is protected and cannot be removed."]'))
} else {
this.removePlaylist(this.id)
this.$router.push(
{
path: '/userPlaylists'
}
)
showToast(this.$t('User Playlists.SinglePlaylistView.Toast["Playlist {playlistName} has been deleted."]', {
playlistName: this.title,
}))
}
},

enableQuickBookmarkForThisPlaylist() {
Expand Down
19 changes: 10 additions & 9 deletions src/renderer/components/privacy-settings/privacy-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ export default defineComponent({
handleSearchCache: function (option) {
this.showSearchCachePrompt = false

if (option === 'delete') {
this.clearSessionSearchHistory()
showToast(this.$t('Settings.Privacy Settings.Search cache has been cleared'))
}
if (option !== 'delete') { return }

this.clearSessionSearchHistory()
showToast(this.$t('Settings.Privacy Settings.Search cache has been cleared'))
},

handleRememberHistory: function (value) {
Expand All @@ -74,10 +74,10 @@ export default defineComponent({
handleRemoveHistory: function (option) {
this.showRemoveHistoryPrompt = false

if (option === 'delete') {
this.removeAllHistory()
showToast(this.$t('Settings.Privacy Settings.Watch history has been cleared'))
}
if (option !== 'delete') { return }

this.removeAllHistory()
showToast(this.$t('Settings.Privacy Settings.Watch history has been cleared'))
},

handleRemoveSubscriptions: function (option) {
Expand Down Expand Up @@ -107,7 +107,8 @@ export default defineComponent({

handleRemovePlaylists: function (option) {
this.showRemovePlaylistsPrompt = false
if (option !== 'yes') { return }

if (option !== 'delete') { return }

this.removeAllPlaylists()
this.updateQuickBookmarkTargetPlaylistId('favorites')
Expand Down