mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 23:06:11 +00:00
[HOTFIX] Fix remove from continue playing
This commit is contained in:
@@ -276,18 +276,19 @@ class DBRomsHandler(DBBaseHandler):
|
||||
|
||||
rom_user = self.get_rom_user_by_id(id)
|
||||
|
||||
if data.get("is_main_sibling", False):
|
||||
rom = self.get_rom(rom_user.rom_id)
|
||||
if not data.get("is_main_sibling", False):
|
||||
return rom_user
|
||||
|
||||
session.execute(
|
||||
update(RomUser)
|
||||
.where(
|
||||
and_(
|
||||
RomUser.rom_id.in_(r.id for r in rom.sibling_roms),
|
||||
RomUser.user_id == rom_user.user_id,
|
||||
)
|
||||
rom = self.get_rom(rom_user.rom_id)
|
||||
session.execute(
|
||||
update(RomUser)
|
||||
.where(
|
||||
and_(
|
||||
RomUser.rom_id.in_(r.id for r in rom.sibling_roms),
|
||||
RomUser.user_id == rom_user.user_id,
|
||||
)
|
||||
.values(is_main_sibling=False)
|
||||
)
|
||||
.values(is_main_sibling=False)
|
||||
)
|
||||
|
||||
return self.get_rom_user_by_id(id)
|
||||
|
||||
@@ -64,7 +64,7 @@ async function switchFromFavourites() {
|
||||
}
|
||||
await collectionApi
|
||||
.updateCollection({ collection: favCollection.value as Collection })
|
||||
.then(({ data }) => {
|
||||
.then(() => {
|
||||
emitter?.emit("snackbarShow", {
|
||||
msg: `${props.rom.name} ${
|
||||
collectionsStore.isFav(props.rom) ? "added to" : "removed from"
|
||||
@@ -101,6 +101,8 @@ async function resetLastPlayed() {
|
||||
color: "green",
|
||||
timeout: 2000,
|
||||
});
|
||||
|
||||
romsStore.removeFromContinuePlaying(props.rom);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
|
||||
@@ -187,7 +187,7 @@ async function updateUserRomProps({
|
||||
romId: number;
|
||||
data: Partial<RomUserSchema>;
|
||||
updateLastPlayed?: boolean;
|
||||
}): Promise<{ data: DetailedRom }> {
|
||||
}): Promise<{ data: RomUserSchema }> {
|
||||
return api.put(`/roms/${romId}/props`, {
|
||||
data: data,
|
||||
update_last_played: updateLastPlayed,
|
||||
|
||||
@@ -101,9 +101,17 @@ export default defineStore("roms", {
|
||||
addToRecent(rom: SimpleRom) {
|
||||
this.recentRoms = [rom, ...this.recentRoms];
|
||||
},
|
||||
removeFromRecent(rom: SimpleRom) {
|
||||
this.recentRoms = this.recentRoms.filter((value) => value.id !== rom.id);
|
||||
},
|
||||
addToContinuePlaying(rom: SimpleRom) {
|
||||
this.continuePlayingRoms = [rom, ...this.continuePlayingRoms];
|
||||
},
|
||||
removeFromContinuePlaying(rom: SimpleRom) {
|
||||
this.continuePlayingRoms = this.continuePlayingRoms.filter(
|
||||
(value) => value.id !== rom.id,
|
||||
);
|
||||
},
|
||||
update(rom: SimpleRom) {
|
||||
this.allRoms = this.allRoms.map((value) =>
|
||||
value.id === rom.id ? rom : value,
|
||||
|
||||
Reference in New Issue
Block a user