1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-30 14:00:07 +02:00

Set random card icon if template has no icon

This commit is contained in:
Chen-I Lim 2020-12-10 10:19:13 -08:00
parent 40902c1803
commit ee71e31dfe

View File

@ -12,6 +12,7 @@ import octoClient from './octoClient'
import undoManager from './undomanager'
import {Utils} from './utils'
import {OctoUtils} from './octoUtils'
import {BlockIcons} from './blockIcons'
//
// The Mutator is used to make all changes to server state
@ -512,6 +513,7 @@ class Mutator {
const newBlocks = newBlocks1.filter((o) => o.type !== 'comment')
Utils.log(`duplicateCard: duplicating ${newBlocks.length} blocks`)
if (asTemplate === newCard.isTemplate) {
// Copy template
newCard.title = `Copy of ${newCard.title}`
} else if (asTemplate) {
// Template from card
@ -519,6 +521,11 @@ class Mutator {
} else {
// Card from template
newCard.title = ''
// If the template doesn't specify an icon, initialize it to a random one
if (!newCard.icon) {
newCard.icon = BlockIcons.shared.randomIcon()
}
}
newCard.isTemplate = asTemplate
await this.insertBlocks(