Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove personal votes #4616

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions server/src/api/event_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import (
"encoding/json"

"github.com/google/uuid"
"scrumlr.io/server/common/dto"
"scrumlr.io/server/database/types"
Expand Down Expand Up @@ -312,6 +311,24 @@

func eventInitFilter(event InitEvent, clientID uuid.UUID) InitEvent {
isMod := isModerator(clientID, event.Data.BoardSessions)

// filter to only respond with the latest voting and its votes
latestVoting := event.Data.Votings

Check failure on line 316 in server/src/api/event_filter.go

View workflow job for this annotation

GitHub Actions / Build and Test – Backend

ineffectual assignment to latestVoting (ineffassign)
if len(event.Data.Votings) != 0 {
latestVoting = make([]*dto.Voting, 0)
activeNotes := make([]*dto.Vote, 0)

latestVoting = append(latestVoting, event.Data.Votings[0])

for _, v := range event.Data.Votes {
if v.Voting == latestVoting[0].ID {
activeNotes = append(activeNotes, v)
}
}
event.Data.Votings = latestVoting
event.Data.Votes = activeNotes
}

if isMod {
return event
}
Expand All @@ -329,9 +346,9 @@
Votes: event.Data.Votes,
},
}

// Columns
filteredColumns := filterColumns(event.Data.Columns)

// Notes
filteredNotes := filterNotes(event.Data.Notes, clientID, event.Data.Board, event.Data.Columns)

Expand Down
Loading
Loading