|
|
@@ -156,7 +156,6 @@ module.exports = (crowi) => {
|
|
|
logo: [
|
|
|
body('isDefaultLogo').isBoolean().optional({ nullable: true }),
|
|
|
body('customizedLogoSrc').isString().optional({ nullable: true }),
|
|
|
- body('currentBrandLogo').isString().optional({ nullable: true }),
|
|
|
],
|
|
|
};
|
|
|
|
|
|
@@ -677,13 +676,12 @@ module.exports = (crowi) => {
|
|
|
router.put('/customize-logo', apiLimiter, loginRequiredStrictly, adminRequired, csrf, validator.logo, apiV3FormValidator, async(req, res) => {
|
|
|
|
|
|
const {
|
|
|
- isDefaultLogo, customizedLogoSrc, currentBrandLogo,
|
|
|
+ isDefaultLogo, customizedLogoSrc,
|
|
|
} = req.body;
|
|
|
|
|
|
const requestParams = {
|
|
|
'customize:isDefaultLogo': isDefaultLogo,
|
|
|
'customize:customizedLogoSrc': customizedLogoSrc,
|
|
|
- 'customize:currentBrandLogo': currentBrandLogo,
|
|
|
};
|
|
|
try {
|
|
|
await crowi.configManager.updateConfigsInTheSameNamespace('crowi', requestParams);
|
|
|
@@ -728,13 +726,10 @@ module.exports = (crowi) => {
|
|
|
let attachment;
|
|
|
try {
|
|
|
attachment = await attachmentService.createAttachment(file, req.user, null, AttachmentType.BRAND_LOGO);
|
|
|
- const isDefaultLogo = await crowi.configManager.getConfig('crowi', 'customize:isDefaultLogo');
|
|
|
const attachmentConfigParams = {
|
|
|
'customize:customizedLogoSrc': attachment.filePathProxied,
|
|
|
};
|
|
|
- if (!isDefaultLogo) {
|
|
|
- attachmentConfigParams['customize:currentBrandLogo'] = attachment.filePathProxied;
|
|
|
- }
|
|
|
+
|
|
|
await crowi.configManager.updateConfigsInTheSameNamespace('crowi', attachmentConfigParams);
|
|
|
}
|
|
|
catch (err) {
|
|
|
@@ -755,15 +750,11 @@ module.exports = (crowi) => {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- const isDefaultLogo = await crowi.configManager.getConfig('crowi', 'customize:isDefaultLogo');
|
|
|
await attachmentService.removeAllAttachments(attachments);
|
|
|
// update attachmentId immediately
|
|
|
const attachmentConfigParams = {
|
|
|
'customize:customizedLogoSrc': null,
|
|
|
};
|
|
|
- if (!isDefaultLogo) {
|
|
|
- attachmentConfigParams['customize:currentBrandLogo'] = null;
|
|
|
- }
|
|
|
await crowi.configManager.updateConfigsInTheSameNamespace('crowi', attachmentConfigParams);
|
|
|
}
|
|
|
catch (err) {
|