Skip to content

Commit

Permalink
Rename isRejected -> isRejectedFn
Browse files Browse the repository at this point in the history
  • Loading branch information
S7evinK committed Oct 24, 2023
1 parent a4ebb31 commit 213d8d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions stateresolution.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func ResolveConflicts(
events []PDU,
authEvents []PDU,
userIDForSender spec.UserIDForSender,
isRejected IsRejected,
isRejectedFn IsRejected,
) ([]PDU, error) {
type stateKeyTuple struct {
Type string
Expand Down Expand Up @@ -390,7 +390,7 @@ func ResolveConflicts(
resolved = ResolveStateConflicts(conflicted, authEvents, userIDForSender)
resolved = append(resolved, notConflicted...)
case StateResV2:
resolved = ResolveStateConflictsV2(conflicted, notConflicted, authEvents, userIDForSender, isRejected)
resolved = ResolveStateConflictsV2(conflicted, notConflicted, authEvents, userIDForSender, isRejectedFn)

Check warning on line 393 in stateresolution.go

View check run for this annotation

Codecov / codecov/patch

stateresolution.go#L393

Added line #L393 was not covered by tests
default:
return nil, fmt.Errorf("unsupported state resolution algorithm %v", stateResAlgo)
}
Expand Down
8 changes: 4 additions & 4 deletions stateresolutionv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type stateResolverV2 struct {
resolvedMembers map[spec.SenderID]PDU // Resolved member events
resolvedOthers map[StateKeyTuple]PDU // Resolved other events
result []PDU // Final list of resolved events
isRejected IsRejected // Check if the given eventID is rejected
isRejectedFn IsRejected // Check if the given eventID is rejected
}

// IsRejected should return if the given eventID is rejected or not.
Expand All @@ -59,7 +59,7 @@ func ResolveStateConflictsV2(
conflicted, unconflicted,
authEvents []PDU,
userIDForSender spec.UserIDForSender,
isRejected IsRejected,
isRejectedFn IsRejected,
) []PDU {
// Prepare the state resolver.
conflictedControlEvents := make([]PDU, 0, len(conflicted))
Expand All @@ -74,7 +74,7 @@ func ResolveStateConflictsV2(
resolvedMembers: make(map[spec.SenderID]PDU, len(conflicted)),
resolvedOthers: make(map[StateKeyTuple]PDU, len(conflicted)),
result: make([]PDU, 0, len(conflicted)+len(unconflicted)),
isRejected: isRejected,
isRejectedFn: isRejectedFn,
}
var roomID *spec.RoomID
if len(conflicted) > 0 {
Expand Down Expand Up @@ -466,7 +466,7 @@ func (r *stateResolverV2) authAndApplyEvents(events []PDU) {
}
if authEv.Type() == spec.MRoomMember && authEv.StateKeyEquals(needed) {
// Don't use rejected events for auth
if r.isRejected(authEventID) {
if r.isRejectedFn(authEventID) {
continue
}
_ = r.authProvider.AddEvent(authEv)
Expand Down

0 comments on commit 213d8d9

Please sign in to comment.