Change activeUsers field type to []string (#3909)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Shivashis Padhi 2022-12-05 17:20:15 +05:30 committed by GitHub
parent e075f408d3
commit 35f681dd75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -34,7 +34,7 @@ type BoardInsight struct {
// IDs of users active on the board // IDs of users active on the board
// required: true // required: true
ActiveUsers string `json:"activeUsers"` ActiveUsers mmModel.StringArray `json:"activeUsers"`
// ID of user who created the board // ID of user who created the board
// required: true // required: true

View file

@ -3,6 +3,7 @@ package sqlstore
import ( import (
"database/sql" "database/sql"
"fmt" "fmt"
"strings"
"time" "time"
"github.com/mattermost/focalboard/server/model" "github.com/mattermost/focalboard/server/model"
@ -129,15 +130,17 @@ func boardsInsightsFromRows(rows *sql.Rows) ([]*model.BoardInsight, error) {
boardsInsights := []*model.BoardInsight{} boardsInsights := []*model.BoardInsight{}
for rows.Next() { for rows.Next() {
var boardInsight model.BoardInsight var boardInsight model.BoardInsight
var activeUsersString string
err := rows.Scan( err := rows.Scan(
&boardInsight.BoardID, &boardInsight.BoardID,
&boardInsight.Title, &boardInsight.Title,
&boardInsight.Icon, &boardInsight.Icon,
&boardInsight.ActivityCount, &boardInsight.ActivityCount,
&boardInsight.ActiveUsers, &activeUsersString,
&boardInsight.CreatedBy, &boardInsight.CreatedBy,
) )
// split activeUsersString into slice
boardInsight.ActiveUsers = strings.Split(activeUsersString, ",")
if err != nil { if err != nil {
return nil, err return nil, err
} }