From 985f0bb56fcb9f67d21b05fce4dbed7a1112047a Mon Sep 17 00:00:00 2001 From: T T Date: Sat, 10 Nov 2018 15:13:44 +0100 Subject: [PATCH] skip not pending request when -list is used --- main.go | 4 ++++ reguser/main.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/main.go b/main.go index 111bb2d..ab35468 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,10 @@ type Request struct { Status string } +func (r *Request) IsPending() bool { + return r.Status == "Pending" +} + func (r *Request) IsValid() bool { return r.Username != "" && r.Email != "" && diff --git a/reguser/main.go b/reguser/main.go index 6ccda32..8e24378 100644 --- a/reguser/main.go +++ b/reguser/main.go @@ -91,6 +91,9 @@ func getAllPendingRequests() { log.Println(err) continue } + if !r.IsPending() { + continue + } log.Printf("%v: %v", r.Username, pathToId(path)) } }