feat: Unified icon picker (#7038)

This commit is contained in:
Hemachandar
2024-06-23 19:01:18 +05:30
committed by GitHub
parent 56d90e6bc3
commit 6fd3a0fa8a
83 changed files with 2302 additions and 852 deletions

View File

@@ -1,5 +1,6 @@
import { FetchError } from "node-fetch";
import { Op } from "sequelize";
import { colorPalette } from "@shared/utils/collections";
import WebhookDisabledEmail from "@server/emails/templates/WebhookDisabledEmail";
import env from "@server/env";
import Logger from "@server/logging/Logger";
@@ -423,12 +424,18 @@ export default class DeliverWebhookTask extends BaseTask<Props> {
paranoid: false,
});
const collection = model && (await presentCollection(undefined, model));
if (collection) {
// For backward compatibility, set a default color.
collection.color = collection.color ?? colorPalette[0];
}
await this.sendWebhook({
event,
subscription,
payload: {
id: event.collectionId,
model: model && (await presentCollection(undefined, model)),
model: collection,
},
});
}
@@ -448,14 +455,20 @@ export default class DeliverWebhookTask extends BaseTask<Props> {
paranoid: false,
});
const collection =
model && (await presentCollection(undefined, model.collection!));
if (collection) {
// For backward compatibility, set a default color.
collection.color = collection.color ?? colorPalette[0];
}
await this.sendWebhook({
event,
subscription,
payload: {
id: event.modelId,
model: model && presentMembership(model),
collection:
model && (await presentCollection(undefined, model.collection!)),
collection,
user: model && presentUser(model.user),
},
});
@@ -476,14 +489,20 @@ export default class DeliverWebhookTask extends BaseTask<Props> {
paranoid: false,
});
const collection =
model && (await presentCollection(undefined, model.collection!));
if (collection) {
// For backward compatibility, set a default color.
collection.color = collection.color ?? colorPalette[0];
}
await this.sendWebhook({
event,
subscription,
payload: {
id: event.modelId,
model: model && presentCollectionGroupMembership(model),
collection:
model && (await presentCollection(undefined, model.collection!)),
collection,
group: model && presentGroup(model.group),
},
});