This repository was archived by the owner on Mar 28, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 15
15
// ErrModeratorInfoMissing indicates when the moderator information is
16
16
// missing while also indicating they are a moderator
17
17
ErrModeratorInfoMissing = errors .New ("moderator is enabled but information is missing" )
18
- // ErrNonModeratorShouldNotHaveInfo indicates when the moderator information
19
- // is present, but not indicating moderator is enabled
20
- ErrNonModeratorShouldNotHaveInfo = errors .New ("moderator information is provided but moderator is not enabled" )
21
18
// ErrMissingModeratorFee indicates the fee schedule is missing
22
19
ErrMissingModeratorFee = errors .New ("moderator info is missing fee schedule" )
23
20
// ErrUnknownModeratorFeeType indicates the feeType is unknown
@@ -130,9 +127,6 @@ func (p *Profile) IsModerationEnabled() bool {
130
127
}
131
128
132
129
func (p * Profile ) validateModeratorFees () error {
133
- if ! p .profileProto .Moderator && p .profileProto .ModeratorInfo != nil {
134
- return ErrNonModeratorShouldNotHaveInfo
135
- }
136
130
if p .profileProto .Moderator && p .profileProto .ModeratorInfo == nil {
137
131
return ErrModeratorInfoMissing
138
132
}
Original file line number Diff line number Diff line change @@ -154,6 +154,24 @@ func TestProfileValidWithoutModeratorInfo(t *testing.T) {
154
154
}
155
155
}
156
156
157
+ func TestProfileValidWithModeratorInfoAndModerationDisabled (t * testing.T ) {
158
+ var (
159
+ p = factory .MustNewProfile ()
160
+ pp = p .GetProtobuf ()
161
+ )
162
+ pp .Moderator = false
163
+ pp .ModeratorInfo = & pb.Moderator {
164
+ Fee : & pb.Moderator_Fee {
165
+ FeeType : pb .Moderator_Fee_PERCENTAGE ,
166
+ Percentage : 0 ,
167
+ },
168
+ }
169
+
170
+ if err := p .Valid (); err != nil {
171
+ t .Errorf ("expected profile to be valid with moderator info and moderation disabled, but errored (%s)" , err )
172
+ }
173
+ }
174
+
157
175
func TestProfileInvalidWithoutModeratorFee (t * testing.T ) {
158
176
var (
159
177
p = factory .MustNewProfile ()
You can’t perform that action at this time.
0 commit comments