Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 8f13bf6

Browse files
authored
Merge pull request #1883 from OpenBazaar/brian.1880
(#1880) Remove validation for non-nil mod info
2 parents 257a3e8 + 595e6d7 commit 8f13bf6

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

repo/profile.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ var (
1212
// ErrModeratorInfoMissing indicates when the moderator information is
1313
// missing while also indicating they are a moderator
1414
ErrModeratorInfoMissing = errors.New("moderator is enabled but information is missing")
15-
// ErrNonModeratorShouldNotHaveInfo indicates when the moderator information
16-
// is present, but not indicating moderator is enabled
17-
ErrNonModeratorShouldNotHaveInfo = errors.New("moderator information is provided but moderator is not enabled")
1815
// ErrMissingModeratorFee indicates the fee schedule is missing
1916
ErrMissingModeratorFee = errors.New("moderator info is missing fee schedule")
2017
// ErrUnknownModeratorFeeType indicates the feeType is unknown
@@ -101,9 +98,6 @@ func (p *Profile) validateModeratorFees() error {
10198
if p.Moderator && p.ModeratorInfo == nil {
10299
return ErrModeratorInfoMissing
103100
}
104-
if !p.Moderator && p.ModeratorInfo != nil {
105-
return ErrNonModeratorShouldNotHaveInfo
106-
}
107101

108102
// Moderator is true, Info is present
109103
if p.ModeratorInfo.Fee == nil {

repo/profile_test.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -358,24 +358,6 @@ func TestProfileInvalidAsModeratorWithoutInfo(t *testing.T) {
358358
}
359359
}
360360

361-
func TestProfileInvalidAsUserWithModeratorInfo(t *testing.T) {
362-
p := factory.NewProfile()
363-
p.Moderator = false
364-
p.ModeratorInfo = &repo.ModeratorInfo{
365-
Fee: &repo.ModeratorFee{
366-
FeeType: pb.Moderator_Fee_PERCENTAGE.String(),
367-
Percentage: 1.1,
368-
FixedFee: nil,
369-
},
370-
}
371-
372-
if err := p.Valid(); err == nil {
373-
t.Errorf("expected regular user with moderator info to be invalid")
374-
} else if err != repo.ErrNonModeratorShouldNotHaveInfo {
375-
t.Errorf("expected ErrNonModeratorShouldNotHaveInfo error, but got (%s)", err.Error())
376-
}
377-
}
378-
379361
func TestProfileSetModeratorFixedFee(t *testing.T) {
380362
p := factory.NewProfile()
381363
p.ModeratorInfo.Fee.FeeType = pb.Moderator_Fee_FIXED_PLUS_PERCENTAGE.String()

0 commit comments

Comments
 (0)