Don't forget to cleanup in-memory sticker pack
This commit is contained in:
parent
d4a30a0165
commit
93f60ee5a6
4 changed files with 7 additions and 9 deletions
|
@ -1497,9 +1497,7 @@ async function addStickerPackReference(messageId: string, packId: string) {
|
|||
await channels.addStickerPackReference(messageId, packId);
|
||||
}
|
||||
async function deleteStickerPackReference(messageId: string, packId: string) {
|
||||
const paths = await channels.deleteStickerPackReference(messageId, packId);
|
||||
|
||||
return paths;
|
||||
return channels.deleteStickerPackReference(messageId, packId);
|
||||
}
|
||||
async function deleteStickerPack(packId: string) {
|
||||
const paths = await channels.deleteStickerPack(packId);
|
||||
|
|
|
@ -390,7 +390,7 @@ export type DataInterface = {
|
|||
deleteStickerPackReference: (
|
||||
messageId: string,
|
||||
packId: string
|
||||
) => Promise<Array<string>>;
|
||||
) => Promise<ReadonlyArray<string> | undefined>;
|
||||
getStickerCount: () => Promise<number>;
|
||||
deleteStickerPack: (packId: string) => Promise<Array<string>>;
|
||||
getAllStickerPacks: () => Promise<Array<StickerPackType>>;
|
||||
|
|
|
@ -5058,7 +5058,7 @@ async function addStickerPackReference(
|
|||
async function deleteStickerPackReference(
|
||||
messageId: string,
|
||||
packId: string
|
||||
): Promise<Array<string>> {
|
||||
): Promise<ReadonlyArray<string> | undefined> {
|
||||
const db = getInstance();
|
||||
|
||||
if (!messageId) {
|
||||
|
@ -5110,7 +5110,7 @@ async function deleteStickerPackReference(
|
|||
}
|
||||
const count = countRow['count(*)'];
|
||||
if (count > 0) {
|
||||
return [];
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const packRow: { status: StickerPackStatusType } = db
|
||||
|
@ -5123,12 +5123,12 @@ async function deleteStickerPackReference(
|
|||
.get({ packId });
|
||||
if (!packRow) {
|
||||
console.log('deleteStickerPackReference: did not find referenced pack');
|
||||
return [];
|
||||
return undefined;
|
||||
}
|
||||
const { status } = packRow;
|
||||
|
||||
if (status === 'installed') {
|
||||
return [];
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const stickerPathRows: Array<{ path: string }> = db
|
||||
|
|
|
@ -796,7 +796,7 @@ export async function deletePackReference(
|
|||
const paths = await Data.deleteStickerPackReference(messageId, packId);
|
||||
|
||||
// If we don't get a list of paths back, then the sticker pack was not deleted
|
||||
if (!paths || !paths.length) {
|
||||
if (!paths) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue