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);
|
await channels.addStickerPackReference(messageId, packId);
|
||||||
}
|
}
|
||||||
async function deleteStickerPackReference(messageId: string, packId: string) {
|
async function deleteStickerPackReference(messageId: string, packId: string) {
|
||||||
const paths = await channels.deleteStickerPackReference(messageId, packId);
|
return channels.deleteStickerPackReference(messageId, packId);
|
||||||
|
|
||||||
return paths;
|
|
||||||
}
|
}
|
||||||
async function deleteStickerPack(packId: string) {
|
async function deleteStickerPack(packId: string) {
|
||||||
const paths = await channels.deleteStickerPack(packId);
|
const paths = await channels.deleteStickerPack(packId);
|
||||||
|
|
|
@ -390,7 +390,7 @@ export type DataInterface = {
|
||||||
deleteStickerPackReference: (
|
deleteStickerPackReference: (
|
||||||
messageId: string,
|
messageId: string,
|
||||||
packId: string
|
packId: string
|
||||||
) => Promise<Array<string>>;
|
) => Promise<ReadonlyArray<string> | undefined>;
|
||||||
getStickerCount: () => Promise<number>;
|
getStickerCount: () => Promise<number>;
|
||||||
deleteStickerPack: (packId: string) => Promise<Array<string>>;
|
deleteStickerPack: (packId: string) => Promise<Array<string>>;
|
||||||
getAllStickerPacks: () => Promise<Array<StickerPackType>>;
|
getAllStickerPacks: () => Promise<Array<StickerPackType>>;
|
||||||
|
|
|
@ -5058,7 +5058,7 @@ async function addStickerPackReference(
|
||||||
async function deleteStickerPackReference(
|
async function deleteStickerPackReference(
|
||||||
messageId: string,
|
messageId: string,
|
||||||
packId: string
|
packId: string
|
||||||
): Promise<Array<string>> {
|
): Promise<ReadonlyArray<string> | undefined> {
|
||||||
const db = getInstance();
|
const db = getInstance();
|
||||||
|
|
||||||
if (!messageId) {
|
if (!messageId) {
|
||||||
|
@ -5110,7 +5110,7 @@ async function deleteStickerPackReference(
|
||||||
}
|
}
|
||||||
const count = countRow['count(*)'];
|
const count = countRow['count(*)'];
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
return [];
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const packRow: { status: StickerPackStatusType } = db
|
const packRow: { status: StickerPackStatusType } = db
|
||||||
|
@ -5123,12 +5123,12 @@ async function deleteStickerPackReference(
|
||||||
.get({ packId });
|
.get({ packId });
|
||||||
if (!packRow) {
|
if (!packRow) {
|
||||||
console.log('deleteStickerPackReference: did not find referenced pack');
|
console.log('deleteStickerPackReference: did not find referenced pack');
|
||||||
return [];
|
return undefined;
|
||||||
}
|
}
|
||||||
const { status } = packRow;
|
const { status } = packRow;
|
||||||
|
|
||||||
if (status === 'installed') {
|
if (status === 'installed') {
|
||||||
return [];
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const stickerPathRows: Array<{ path: string }> = db
|
const stickerPathRows: Array<{ path: string }> = db
|
||||||
|
|
|
@ -796,7 +796,7 @@ export async function deletePackReference(
|
||||||
const paths = await Data.deleteStickerPackReference(messageId, packId);
|
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 we don't get a list of paths back, then the sticker pack was not deleted
|
||||||
if (!paths || !paths.length) {
|
if (!paths) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue