main

mattermost/focalboard

Last updated at: 29/12/2023 09:40

links.go

TLDR

The links.go file in the utils package contains two methods: MakeCardLink and MakeBoardLink. These methods are used to create fully qualified card and board links based on the provided parameters.

Methods

MakeCardLink

The MakeCardLink method creates a fully qualified card link based on the provided server root, team ID, board ID, and card ID. It uses the fmt.Sprintf function to format the link in the following pattern: <serverRoot>/team/<teamID>/<boardID>/0/<cardID>. The resulting link is returned as a string.

MakeBoardLink

The MakeBoardLink method creates a fully qualified board link based on the provided server root, team ID, and board name. It uses the fmt.Sprintf function to format the link in the following pattern: <serverRoot>/team/<teamID>/<board>. The resulting link is returned as a string.

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

package utils

import "fmt"

// MakeCardLink creates fully qualified card links based on card id and parents.
func MakeCardLink(serverRoot string, teamID string, boardID string, cardID string) string {
	return fmt.Sprintf("%s/team/%s/%s/0/%s", serverRoot, teamID, boardID, cardID)
}

func MakeBoardLink(serverRoot string, teamID string, board string) string {
	return fmt.Sprintf("%s/team/%s/%s", serverRoot, teamID, board)
}