Skip to content

Commit

Permalink
Merge pull request #164
Browse files Browse the repository at this point in the history
Added additional condition for update quota
  • Loading branch information
bsrinivas8687 authored Mar 13, 2022
2 parents f1831f0 + 8c9465a commit 7001dc8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions x/subscription/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ func (k *msgServer) MsgUpdateQuota(c context.Context, msg *types.MsgUpdateQuotaR
if !found {
return nil, types.ErrorSubscriptionDoesNotExist
}
if subscription.Plan == 0 {
return nil, types.ErrorCanNotUpdateQuota
}
if msg.From != subscription.Owner {
return nil, types.ErrorUnauthorized
}
Expand Down
3 changes: 2 additions & 1 deletion x/subscription/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ var (
ErrorDuplicateQuota = errors.Register(ModuleName, 211, "duplicate quota")
ErrorQuotaDoesNotExist = errors.Register(ModuleName, 212, "quota does not exist")
ErrorCanNotAddQuota = errors.Register(ModuleName, 213, "can not add quota")
ErrorCanNotCancel = errors.Register(ModuleName, 214, "can not cancel")
ErrorCanNotUpdateQuota = errors.Register(ModuleName, 214, "can not update quota")
ErrorCanNotCancel = errors.Register(ModuleName, 215, "can not cancel")
)

0 comments on commit 7001dc8

Please sign in to comment.