summaryrefslogtreecommitdiffstats
path: root/models/unit.go
diff options
context:
space:
mode:
authorMorlinest <Morlinest@users.noreply.github.com>2017-10-01 15:50:56 +0200
committerLauris BH <lauris@nix.lv>2017-10-01 16:50:56 +0300
commit1ad902d5298202d5be14fd5a9c8ed6ce781a23c8 (patch)
treea4554edf9987b2d7088da89c909b7b4502f432bd /models/unit.go
parentbae9cbce9c8fa02e62260e5bf4744d211c85f690 (diff)
downloadgitea-1ad902d5298202d5be14fd5a9c8ed6ce781a23c8.tar.gz
gitea-1ad902d5298202d5be14fd5a9c8ed6ce781a23c8.zip
Fix implementation of repo Home func (#2601)
* Fix implementation of repo Home func * Make fixture changes for testing
Diffstat (limited to 'models/unit.go')
-rw-r--r--models/unit.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/models/unit.go b/models/unit.go
index a14edcec0c..1d26359528 100644
--- a/models/unit.go
+++ b/models/unit.go
@@ -60,6 +60,14 @@ func (u *Unit) CanDisable() bool {
return true
}
+// IsLessThan compares order of two units
+func (u Unit) IsLessThan(unit Unit) bool {
+ if (u.Type == UnitTypeExternalTracker || u.Type == UnitTypeExternalWiki) && unit.Type != UnitTypeExternalTracker && unit.Type != UnitTypeExternalWiki {
+ return false
+ }
+ return u.Idx < unit.Idx
+}
+
// Enumerate all the units
var (
UnitCode = Unit{