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: channel groups duplicated after updating name #5825

Merged
merged 1 commit into from
Mar 28, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@

updateConfirmStatus()
binding.confirm.setOnClickListener {
channelGroupsModel.groupToEdit?.name = binding.groupName.text.toString()
if (channelGroupsModel.groupToEdit?.name.isNullOrBlank()) return@setOnClickListener
saveGroup(channelGroupsModel.groupToEdit!!, oldGroupName)
val updatedGroup = channelGroupsModel.groupToEdit?.copy(

Check failure on line 67 in app/src/main/java/com/github/libretube/ui/sheets/EditChannelGroupSheet.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 A multiline expression should start on a new line Raw Output: app/src/main/java/com/github/libretube/ui/sheets/EditChannelGroupSheet.kt:67:32: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)
name = binding.groupName.text.toString().ifEmpty { return@setOnClickListener }

Check failure on line 68 in app/src/main/java/com/github/libretube/ui/sheets/EditChannelGroupSheet.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 Missing trailing comma before ")" Raw Output: app/src/main/java/com/github/libretube/ui/sheets/EditChannelGroupSheet.kt:68:95: error: Missing trailing comma before ")" (standard:trailing-comma-on-call-site)
) ?: return@setOnClickListener
saveGroup(updatedGroup, oldGroupName)

dismiss()
}
}
Expand All @@ -78,10 +80,9 @@
?.plus(group)

CoroutineScope(Dispatchers.IO).launch {
runCatching {
// delete the old one as it might have a different name
DatabaseHolder.Database.subscriptionGroupsDao().deleteGroup(oldGroupName)
}
// delete the old version of the group first before updating it, as the name is the
// primary key
DatabaseHolder.Database.subscriptionGroupsDao().deleteGroup(oldGroupName)
DatabaseHolder.Database.subscriptionGroupsDao().createGroup(group)
}
}
Expand Down
Loading