Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
fix origin set emotes not overwriting emotes when at capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
broadeditz committed Dec 3, 2023
1 parent 6ba569a commit 2a4ae35
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions data/query/query.emote-set.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ func applyOriginSets(sets []structures.EmoteSet, originSets []structures.EmoteSe
origin.Set = &subset

for _, emote := range subset.Emotes {
if len(set.Emotes) >= int(set.Capacity) {
break
}

if index, ok := emoteNameIndexes[emote.Name]; ok {
if set.Emotes[index].ID == emote.ID {
continue
Expand All @@ -98,6 +94,11 @@ func applyOriginSets(sets []structures.EmoteSet, originSets []structures.EmoteSe
emote.Origin = origin
set.Emotes[index] = emote
} else {
// don't exceed capacity, but we still replace other origin set emotes
if len(set.Emotes) >= int(set.Capacity) {
continue
}

// add emote to set emotes
emoteNameIndexes[emote.Name] = len(set.Emotes)
set.Emotes = append(set.Emotes, emote)
Expand Down

0 comments on commit 2a4ae35

Please sign in to comment.