File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,14 @@ func (u Unit) IsLessThan(unit Unit) bool {
193193 return u .Idx < unit .Idx
194194}
195195
196+ // MaxPerm returns the max perms of this unit
197+ func (u Unit ) MaxPerm () perm.AccessMode {
198+ if u .Type == TypeExternalTracker || u .Type == TypeExternalWiki {
199+ return perm .AccessModeRead
200+ }
201+ return perm .AccessModeAdmin
202+ }
203+
196204// Enumerate all the units
197205var (
198206 UnitCode = Unit {
Original file line number Diff line number Diff line change 8989 </thead>
9090 <tbody>
9191 {{range $t, $unit := $.Units}}
92- {{if ge $unit.MaxPerms 2}}
92+ {{if ge $unit.MaxPerm 2}}
9393 <tr>
9494 <td>
95- <div {{if $unit.Type.UnitGlobalDisabled}}class="field tooltip" data-content="{{$.i18n.Tr "repo.unit_disabled"}}"> {{- else -}}class="field"{{end}}>
95+ <div {{if $unit.Type.UnitGlobalDisabled}}class="field tooltip" data-content="{{$.i18n.Tr "repo.unit_disabled"}}"{{- else -}}class="field"{{end}}>
9696 <div class="ui">
9797 <label>{{$.i18n.Tr $unit.NameKey}}{{if $unit.Type.UnitGlobalDisabled}} {{$.i18n.Tr "org.team_unit_disabled"}}{{end}}</label>
9898 <span class="help">{{$.i18n.Tr $unit.DescKey}}</span>
120120 </tbody>
121121 </table>
122122 {{range $t, $unit := $.Units}}
123- {{if lt $unit.MaxPerms 2}}
123+ {{if lt $unit.MaxPerm 2}}
124124 <div {{if $unit.Type.UnitGlobalDisabled}}class="field tooltip" data-content="{{$.i18n.Tr "repo.unit_disabled"}}"{{else}}class="field"{{end}}>
125125 <div class="ui checkbox">
126126 <input type="checkbox" class="hidden" name="unit_{{$unit.Type.Value}}" value="1"{{if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode $unit.Type) 1)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}}>
You can’t perform that action at this time.
0 commit comments