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>
198 lines
4.9 KiB
Go
198 lines
4.9 KiB
Go
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
"strconv"
|
|
|
|
"github.com/mattermost/focalboard/server/services/audit"
|
|
)
|
|
|
|
// Block is the basic data unit
|
|
// swagger:model
|
|
type Block struct {
|
|
// The id for this block
|
|
// required: true
|
|
ID string `json:"id"`
|
|
|
|
// The id for this block's parent block. Empty for root blocks
|
|
// required: false
|
|
ParentID string `json:"parentId"`
|
|
|
|
// The id for this block's root block
|
|
// required: true
|
|
RootID string `json:"rootId"`
|
|
|
|
// The id for user who created this block
|
|
// required: true
|
|
CreatedBy string `json:"createdBy"`
|
|
|
|
// The id for user who last modified this block
|
|
// required: true
|
|
ModifiedBy string `json:"modifiedBy"`
|
|
|
|
// The schema version of this block
|
|
// required: true
|
|
Schema int64 `json:"schema"`
|
|
|
|
// The block type
|
|
// required: true
|
|
Type BlockType `json:"type"`
|
|
|
|
// The display title
|
|
// required: false
|
|
Title string `json:"title"`
|
|
|
|
// The block fields
|
|
// required: false
|
|
Fields map[string]interface{} `json:"fields"`
|
|
|
|
// The creation time
|
|
// required: true
|
|
CreateAt int64 `json:"createAt"`
|
|
|
|
// The last modified time
|
|
// required: true
|
|
UpdateAt int64 `json:"updateAt"`
|
|
|
|
// The deleted time. Set to indicate this block is deleted
|
|
// required: false
|
|
DeleteAt int64 `json:"deleteAt"`
|
|
|
|
// The workspace id that the block belongs to
|
|
// required: true
|
|
WorkspaceID string `json:"workspaceId"`
|
|
}
|
|
|
|
// BlockPatch is a patch for modify blocks
|
|
// swagger:model
|
|
type BlockPatch struct {
|
|
// The id for this block's parent block. Empty for root blocks
|
|
// required: false
|
|
ParentID *string `json:"parentId"`
|
|
|
|
// The id for this block's root block
|
|
// required: false
|
|
RootID *string `json:"rootId"`
|
|
|
|
// The schema version of this block
|
|
// required: false
|
|
Schema *int64 `json:"schema"`
|
|
|
|
// The block type
|
|
// required: false
|
|
Type *BlockType `json:"type"`
|
|
|
|
// The display title
|
|
// required: false
|
|
Title *string `json:"title"`
|
|
|
|
// The block updated fields
|
|
// required: false
|
|
UpdatedFields map[string]interface{} `json:"updatedFields"`
|
|
|
|
// The block removed fields
|
|
// required: false
|
|
DeletedFields []string `json:"deletedFields"`
|
|
}
|
|
|
|
// BlockPatchBatch is a batch of IDs and patches for modify blocks
|
|
// swagger:model
|
|
type BlockPatchBatch struct {
|
|
// The id's for of the blocks to patch
|
|
BlockIDs []string `json:"block_ids"`
|
|
|
|
// The BlockPatches to be applied
|
|
BlockPatches []BlockPatch `json:"block_patches"`
|
|
}
|
|
|
|
// BlockModifier is a callback that can modify each block during an import.
|
|
// A cache of arbitrary data will be passed for each call and any changes
|
|
// to the cache will be preserved for the next call.
|
|
// Return true to import the block or false to skip import.
|
|
type BlockModifier func(block *Block, cache map[string]interface{}) bool
|
|
|
|
func BlocksFromJSON(data io.Reader) []Block {
|
|
var blocks []Block
|
|
_ = json.NewDecoder(data).Decode(&blocks)
|
|
return blocks
|
|
}
|
|
|
|
// LogClone implements the `mlog.LogCloner` interface to provide a subset of Block fields for logging.
|
|
func (b Block) LogClone() interface{} {
|
|
return struct {
|
|
ID string
|
|
ParentID string
|
|
RootID string
|
|
Type BlockType
|
|
}{
|
|
ID: b.ID,
|
|
ParentID: b.ParentID,
|
|
RootID: b.RootID,
|
|
Type: b.Type,
|
|
}
|
|
}
|
|
|
|
// Patch returns an update version of the block.
|
|
func (p *BlockPatch) Patch(block *Block) *Block {
|
|
if p.ParentID != nil {
|
|
block.ParentID = *p.ParentID
|
|
}
|
|
|
|
if p.RootID != nil {
|
|
block.RootID = *p.RootID
|
|
}
|
|
|
|
if p.Schema != nil {
|
|
block.Schema = *p.Schema
|
|
}
|
|
|
|
if p.Type != nil {
|
|
block.Type = *p.Type
|
|
}
|
|
|
|
if p.Title != nil {
|
|
block.Title = *p.Title
|
|
}
|
|
|
|
for key, field := range p.UpdatedFields {
|
|
block.Fields[key] = field
|
|
}
|
|
|
|
for _, key := range p.DeletedFields {
|
|
delete(block.Fields, key)
|
|
}
|
|
|
|
return block
|
|
}
|
|
|
|
// QuerySubtreeOptions are query options that can be passed to GetSubTree methods.
|
|
type QuerySubtreeOptions struct {
|
|
BeforeUpdateAt int64 // if non-zero then filter for records with update_at less than BeforeUpdateAt
|
|
AfterUpdateAt int64 // if non-zero then filter for records with update_at greater than AfterUpdateAt
|
|
Limit uint64 // if non-zero then limit the number of returned records
|
|
}
|
|
|
|
// QueryBlockHistoryOptions are query options that can be passed to GetBlockHistory.
|
|
type QueryBlockHistoryOptions struct {
|
|
BeforeUpdateAt int64 // if non-zero then filter for records with update_at less than BeforeUpdateAt
|
|
AfterUpdateAt int64 // if non-zero then filter for records with update_at greater than AfterUpdateAt
|
|
Limit uint64 // if non-zero then limit the number of returned records
|
|
Descending bool // if true then the records are sorted by insert_at in descending order
|
|
}
|
|
|
|
func StampModificationMetadata(userID string, blocks []Block, auditRec *audit.Record) {
|
|
if userID == SingleUser {
|
|
userID = ""
|
|
}
|
|
|
|
now := GetMillis()
|
|
for i := range blocks {
|
|
blocks[i].ModifiedBy = userID
|
|
blocks[i].UpdateAt = now
|
|
|
|
if auditRec != nil {
|
|
auditRec.AddMeta("block_"+strconv.FormatInt(int64(i), 10), blocks[i])
|
|
}
|
|
}
|
|
}
|