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
// required: true
ActiveUsers string `json:"activeUsers"`
ActiveUsers mmModel.StringArray `json:"activeUsers"`
// ID of user who created the board
// required: true

View file

@ -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
}