1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-03-06 15:36:17 +02:00

utils.BlockType2IDType (#1715)

This commit is contained in:
Doug Lauder 2021-11-02 04:17:53 -04:00 committed by GitHub
parent 1b10890f72
commit c3a08c3418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,8 @@ import (
"encoding/json"
"time"
"github.com/mattermost/focalboard/server/model"
mm_model "github.com/mattermost/mattermost-server/v6/model"
)
@ -29,6 +31,21 @@ func NewID(idType IDType) string {
return string(idType) + mm_model.NewId()
}
// BlockType2IDType returns an appropriate IDType for the specified BlockType.
func BlockType2IDType(blockType model.BlockType) IDType {
switch blockType {
case model.TypeBoard:
return IDTypeBoard
case model.TypeCard:
return IDTypeCard
case model.TypeView:
return IDTypeView
case model.TypeText, model.TypeComment:
return IDTypeBlock
}
return IDTypeNone
}
// GetMillis is a convenience method to get milliseconds since epoch.
func GetMillis() int64 {
return mm_model.GetMillis()