diff options
author | Morlinest <Morlinest@users.noreply.github.com> | 2017-10-01 15:50:56 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-10-01 16:50:56 +0300 |
commit | 1ad902d5298202d5be14fd5a9c8ed6ce781a23c8 (patch) | |
tree | a4554edf9987b2d7088da89c909b7b4502f432bd /models | |
parent | bae9cbce9c8fa02e62260e5bf4744d211c85f690 (diff) | |
download | gitea-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')
-rw-r--r-- | models/fixtures/repo_unit.yml | 24 | ||||
-rw-r--r-- | models/unit.go | 8 |
2 files changed, 20 insertions, 12 deletions
diff --git a/models/fixtures/repo_unit.yml b/models/fixtures/repo_unit.yml index 57cf35e198..ef06107928 100644 --- a/models/fixtures/repo_unit.yml +++ b/models/fixtures/repo_unit.yml @@ -1,40 +1,40 @@ - id: 1 repo_id: 1 - type: 1 - index: 0 + type: 4 + index: 3 config: "{}" created_unix: 946684810 - id: 2 repo_id: 1 - type: 2 - index: 1 - config: "{\"EnableTimetracker\":true,\"AllowOnlyContributorsToTrackTime\":true}" + type: 5 + index: 4 + config: "{}" created_unix: 946684810 - id: 3 repo_id: 1 - type: 3 - index: 2 + type: 1 + index: 0 config: "{}" created_unix: 946684810 - id: 4 repo_id: 1 - type: 4 - index: 3 - config: "{}" + type: 2 + index: 1 + config: "{\"EnableTimetracker\":true,\"AllowOnlyContributorsToTrackTime\":true}" created_unix: 946684810 - id: 5 repo_id: 1 - type: 5 - index: 4 + type: 3 + index: 2 config: "{}" created_unix: 946684810 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{ |