summaryrefslogtreecommitdiffstats
path: root/modules/util/util.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-10-25 01:36:19 +0800
committerLauris BH <lauris@nix.lv>2017-10-24 20:36:19 +0300
commit6eeadb2082193f8e3dc5269dfc6da2daef7eb6a1 (patch)
treed28d3be3451194e98a5c01097347e7eebdb6393f /modules/util/util.go
parent03900303a9500b33b33ff03fd6dd325147a1117e (diff)
downloadgitea-6eeadb2082193f8e3dc5269dfc6da2daef7eb6a1.tar.gz
gitea-6eeadb2082193f8e3dc5269dfc6da2daef7eb6a1.zip
Hide unactive on explore users and some refactors (#2741)
* hide unactive on explore users and some refactors * fix test for removed Organizations * fix test for removed Organizations * fix imports * fix logic bug * refactor the toConds * Rename TestOrganizations to TestSearchUsers and add tests for users * fix other tests * fix other tests * fix watchers tests * fix comments and remove unused code
Diffstat (limited to 'modules/util/util.go')
-rw-r--r--modules/util/util.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/util/util.go b/modules/util/util.go
index 4859965388..104c80f524 100644
--- a/modules/util/util.go
+++ b/modules/util/util.go
@@ -16,6 +16,21 @@ const (
OptionalBoolFalse
)
+// IsTrue return true if equal to OptionalBoolTrue
+func (o OptionalBool) IsTrue() bool {
+ return o == OptionalBoolTrue
+}
+
+// IsFalse return true if equal to OptionalBoolFalse
+func (o OptionalBool) IsFalse() bool {
+ return o == OptionalBoolFalse
+}
+
+// IsNone return true if equal to OptionalBoolNone
+func (o OptionalBool) IsNone() bool {
+ return o == OptionalBoolNone
+}
+
// OptionalBoolOf get the corresponding OptionalBool of a bool
func OptionalBoolOf(b bool) OptionalBool {
if b {