Commit 5ddbd6ae authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch...

Merge branch '262051-design-thumbnail-image-is-not-updated-after-uploading-an-image-with-the-same-filename' into 'master'

Update Design thumbnail after uploading an image with the same filename

See merge request gitlab-org/gitlab!44305
parents 42aaef1d 62bd5936
/* eslint-disable @gitlab/require-i18n-strings */
import { groupBy } from 'lodash';
import { differenceBy } from 'lodash';
import produce from 'immer';
import { deprecatedCreateFlash as createFlash } from '~/flash';
import { extractCurrentDiscussion, extractDesign, extractDesigns } from './design_management_utils';
......@@ -132,10 +132,13 @@ const addNewDesignToStore = (store, designManagementUpload, query) => {
const data = produce(sourceData, draftData => {
const currentDesigns = extractDesigns(draftData);
const existingDesigns = groupBy(currentDesigns, 'filename');
const newDesigns = currentDesigns.concat(
designManagementUpload.designs.filter(d => !existingDesigns[d.filename]),
);
const difference = differenceBy(designManagementUpload.designs, currentDesigns, 'filename');
const newDesigns = currentDesigns
.map(design => {
return designManagementUpload.designs[design.filename] || design;
})
.concat(difference);
let newVersionNode;
const findNewVersions = designManagementUpload.designs.find(design => design.versions);
......
---
title: Update Design thumbnail after uploading an image with the same filename
merge_request: 44305
author:
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment