Fix labels randomly changing color after saving
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import AbstractService from './abstractService'
|
||||
import LabelModel from '../models/label'
|
||||
import {formatISO} from 'date-fns'
|
||||
import {colorFromHex} from '@/helpers/color/colorFromHex'
|
||||
|
||||
export default class LabelService extends AbstractService {
|
||||
constructor() {
|
||||
@ -16,7 +17,7 @@ export default class LabelService extends AbstractService {
|
||||
processModel(label) {
|
||||
label.created = formatISO(new Date(label.created))
|
||||
label.updated = formatISO(new Date(label.updated))
|
||||
label.hexColor = label.hexColor.substring(1, 7)
|
||||
label.hexColor = colorFromHex(label.hexColor)
|
||||
return label
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ import AbstractService from './abstractService'
|
||||
import ListModel from '../models/list'
|
||||
import TaskService from './task'
|
||||
import {formatISO} from 'date-fns'
|
||||
import {colorFromHex} from '@/helpers/color/colorFromHex'
|
||||
|
||||
export default class ListService extends AbstractService {
|
||||
constructor() {
|
||||
@ -29,12 +30,12 @@ export default class ListService extends AbstractService {
|
||||
model.tasks = model.tasks.map(task => {
|
||||
return taskService.beforeUpdate(task)
|
||||
})
|
||||
model.hexColor = model.hexColor.substring(1, 7)
|
||||
model.hexColor = colorFromHex(model.hexColor)
|
||||
return model
|
||||
}
|
||||
|
||||
beforeCreate(list) {
|
||||
list.hexColor = list.hexColor.substring(1, 7)
|
||||
list.hexColor = colorFromHex(list.hexColor)
|
||||
return list
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import AbstractService from './abstractService'
|
||||
import NamespaceModel from '../models/namespace'
|
||||
import {formatISO} from 'date-fns'
|
||||
import {colorFromHex} from '@/helpers/color/colorFromHex'
|
||||
|
||||
export default class NamespaceService extends AbstractService {
|
||||
constructor() {
|
||||
@ -24,12 +25,12 @@ export default class NamespaceService extends AbstractService {
|
||||
}
|
||||
|
||||
beforeUpdate(namespace) {
|
||||
namespace.hexColor = namespace.hexColor.substring(1, 7)
|
||||
namespace.hexColor = colorFromHex(namespace.hexColor)
|
||||
return namespace
|
||||
}
|
||||
|
||||
beforeCreate(namespace) {
|
||||
namespace.hexColor = namespace.hexColor.substring(1, 7)
|
||||
namespace.hexColor = colorFromHex(namespace.hexColor)
|
||||
return namespace
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import AttachmentService from './attachment'
|
||||
import LabelService from './label'
|
||||
|
||||
import {formatISO} from 'date-fns'
|
||||
import {colorFromHex} from '@/helpers/color/colorFromHex'
|
||||
|
||||
const parseDate = date => {
|
||||
if (date) {
|
||||
@ -86,9 +87,7 @@ export default class TaskService extends AbstractService {
|
||||
}
|
||||
model.repeatAfter = repeatAfterSeconds
|
||||
|
||||
if (model.hexColor.substring(0, 1) === '#') {
|
||||
model.hexColor = model.hexColor.substring(1, 7)
|
||||
}
|
||||
model.hexColor = colorFromHex(model.hexColor)
|
||||
|
||||
// Do the same for all related tasks
|
||||
Object.keys(model.relatedTasks).forEach(relationKind => {
|
||||
|
Reference in New Issue
Block a user