From 35f681dd75302ce972a12a49d97a68f66aacfa53 Mon Sep 17 00:00:00 2001 From: Shivashis Padhi Date: Mon, 5 Dec 2022 17:20:15 +0530 Subject: [PATCH] Change activeUsers field type to []string (#3909) Co-authored-by: Mattermod --- server/model/board_insights.go | 2 +- server/services/store/sqlstore/board_insights.go | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/model/board_insights.go b/server/model/board_insights.go index d4beaf04d..401cad701 100644 --- a/server/model/board_insights.go +++ b/server/model/board_insights.go @@ -34,7 +34,7 @@ type BoardInsight struct { // IDs of users active on the board // required: true - ActiveUsers string `json:"activeUsers"` + ActiveUsers mmModel.StringArray `json:"activeUsers"` // ID of user who created the board // required: true diff --git a/server/services/store/sqlstore/board_insights.go b/server/services/store/sqlstore/board_insights.go index f98e662be..73c92c9f6 100644 --- a/server/services/store/sqlstore/board_insights.go +++ b/server/services/store/sqlstore/board_insights.go @@ -3,6 +3,7 @@ package sqlstore import ( "database/sql" "fmt" + "strings" "time" "github.com/mattermost/focalboard/server/model" @@ -129,15 +130,17 @@ func boardsInsightsFromRows(rows *sql.Rows) ([]*model.BoardInsight, error) { boardsInsights := []*model.BoardInsight{} for rows.Next() { var boardInsight model.BoardInsight - + var activeUsersString string err := rows.Scan( &boardInsight.BoardID, &boardInsight.Title, &boardInsight.Icon, &boardInsight.ActivityCount, - &boardInsight.ActiveUsers, + &activeUsersString, &boardInsight.CreatedBy, ) + // split activeUsersString into slice + boardInsight.ActiveUsers = strings.Split(activeUsersString, ",") if err != nil { return nil, err }