mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-24 13:43:12 +02:00
ab3bf6312c
* Persistent user config (#2133) * Added user config API * Add unit tests * lint fix * Fixed webapp tests * Fixed webapp tests * Updated props in store after updating * Minor fixes * Removed redundent data from audit logs * Onboarding Tour (#2287) * Created private board * Roughly displayed tour * Synced with Dhama's changes * WIP * Trying to add GIF * Added 3 tour steps * WIP * WIP * WIP * checked in missed file * Synced with feature branch * WIp * Adde skip tour option * Fixed image loading for on-prem * Made tour work on presonal server: * Adde missed file * Adding telemetry * Adding telemetry * Added tour tip telemetry * Fixed pulsating dot styling for personal server * reverted personal config * Added reset tour button * Displayed share tour tip of feature is enabled * Lint fixes * Fixed webapp tests * Fixed webapp tests * Completed webapp tests * Completed webapp tests * Webapp lint fixes * Added server tests * Testing cypress skip tour fix * Fixed Cypress tests * Added share board tour step * Added share board tour step * webapp lint fixes * Updated logic to pick welcome board * Updated tests: * lint fixes * Updating UI changes * Fixed a bug causing card tour to re-appear * FIxed minor issue * FIxed bug where card tour didn't start in clickingh on card * Fixed tests * Make update user props use string instead of interface * Fixed a value type * Updating gif size * Updating resolution breakpoint * Updating tutorial tip * Updating view selector * Refactored tour components * Misc fixes * minor refactoring * GH-2258: allow date range to overflow (#2268) * allow date range to overflow * Fixed issue with date overflowing into neighbouring column Co-authored-by: Harshil Sharma <harshilsharma63@gmail.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> * Update readme with accurate Linux standalone app build instructions (#2351) * Bump follow-redirects from 1.14.7 to 1.14.8 in /experiments/webext (#2339) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Switch component style fixed: selector specificity increased by adding additional class. (#2179) * Adding sever side undelete endpoint (#2222) * Adding sever side undelete endpoint * Removing long lines golangci-lint errors * Fixing linter errors * Fixing a test problem * Fixing tests Co-authored-by: Mattermod <mattermod@users.noreply.github.com> * Removing transactions from sqlite backend (#2361) * Removing transactions from sqlite backend * Skipping tests in sqlite because the lack of transactions * Generating the mocks * Fixing golangci-lint * Fixing problem opening the tour tooltip on card open * Fixing texts missmatch * Adding the Product Tour entry in the user settings menu * Fixing some tests * Fixing tests Co-authored-by: Asaad Mahmood <asaadmahmood@users.noreply.github.com> Co-authored-by: Scott Bishel <scott.bishel@mattermost.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Doug Lauder <wiggin77@warpmail.net> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: kamre <eremchenko@gmail.com> Co-authored-by: Jesús Espino <jespinog@gmail.com> * Restored package json * Restored package json Co-authored-by: Asaad Mahmood <asaadmahmood@users.noreply.github.com> Co-authored-by: Scott Bishel <scott.bishel@mattermost.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Doug Lauder <wiggin77@warpmail.net> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: kamre <eremchenko@gmail.com> Co-authored-by: Jesús Espino <jespinog@gmail.com>
110 lines
2.7 KiB
Go
110 lines
2.7 KiB
Go
package app
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/mattermost/focalboard/server/model"
|
|
"github.com/mattermost/focalboard/server/services/store"
|
|
)
|
|
|
|
const (
|
|
KeyPrefix = "focalboard_" // use key prefix to namespace focalboard props
|
|
KeyOnboardingTourStarted = KeyPrefix + "onboardingTourStarted"
|
|
KeyOnboardingTourCategory = KeyPrefix + "tourCategory"
|
|
KeyOnboardingTourStep = KeyPrefix + "onboardingTourStep"
|
|
|
|
ValueOnboardingFirstStep = "0"
|
|
ValueTourCategoryOnboarding = "onboarding"
|
|
|
|
WelcomeBoardTitle = "Welcome to Boards!"
|
|
)
|
|
|
|
var (
|
|
errUnableToFindWelcomeBoard = errors.New("unable to find welcome board in newly created blocks")
|
|
)
|
|
|
|
func (a *App) PrepareOnboardingTour(userID string) (string, string, error) {
|
|
// create a private workspace for the user
|
|
workspaceID, err := a.store.CreatePrivateWorkspace(userID)
|
|
if err != nil {
|
|
return "", "", err
|
|
}
|
|
|
|
// copy the welcome board into this workspace
|
|
boardID, err := a.createWelcomeBoard(userID, workspaceID)
|
|
if err != nil {
|
|
return "", "", err
|
|
}
|
|
|
|
// set user's tour state to initial state
|
|
userPropPatch := model.UserPropPatch{
|
|
UpdatedFields: map[string]string{
|
|
KeyOnboardingTourStarted: "1",
|
|
KeyOnboardingTourStep: ValueOnboardingFirstStep,
|
|
KeyOnboardingTourCategory: ValueTourCategoryOnboarding,
|
|
},
|
|
}
|
|
if err := a.store.PatchUserProps(userID, userPropPatch); err != nil {
|
|
return "", "", err
|
|
}
|
|
|
|
return workspaceID, boardID, nil
|
|
}
|
|
|
|
func (a *App) getOnboardingBoardID() (string, error) {
|
|
blocks, err := a.store.GetDefaultTemplateBlocks()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
var onboardingBoardID string
|
|
for _, block := range blocks {
|
|
if block.Type == model.TypeBoard && block.Title == WelcomeBoardTitle {
|
|
onboardingBoardID = block.ID
|
|
break
|
|
}
|
|
}
|
|
|
|
if onboardingBoardID == "" {
|
|
return "", errUnableToFindWelcomeBoard
|
|
}
|
|
|
|
return onboardingBoardID, nil
|
|
}
|
|
|
|
func (a *App) createWelcomeBoard(userID, workspaceID string) (string, error) {
|
|
onboardingBoardID, err := a.getOnboardingBoardID()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
blocks, err := a.GetSubTree(store.Container{WorkspaceID: "0"}, onboardingBoardID, 3)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
blocks = model.GenerateBlockIDs(blocks, a.logger)
|
|
|
|
// we're copying from a global template, so we need to set the
|
|
// `isTemplate` flag to false on the board
|
|
var welcomeBoardID string
|
|
for i := range blocks {
|
|
if blocks[i].Type == model.TypeBoard {
|
|
blocks[i].Fields["isTemplate"] = false
|
|
|
|
if blocks[i].Title == WelcomeBoardTitle {
|
|
welcomeBoardID = blocks[i].ID
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
model.StampModificationMetadata(userID, blocks, nil)
|
|
_, err = a.InsertBlocks(store.Container{WorkspaceID: workspaceID}, blocks, userID, false)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return welcomeBoardID, nil
|
|
}
|