File tree 2 files changed +11
-3
lines changed
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 {
193
193
return u .Idx < unit .Idx
194
194
}
195
195
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
+
196
204
// Enumerate all the units
197
205
var (
198
206
UnitCode = Unit {
Original file line number Diff line number Diff line change 89
89
</thead>
90
90
<tbody>
91
91
{{range $t, $unit := $.Units}}
92
- {{if ge $unit.MaxPerms 2}}
92
+ {{if ge $unit.MaxPerm 2}}
93
93
<tr>
94
94
<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}}>
96
96
<div class="ui">
97
97
<label>{{$.i18n.Tr $unit.NameKey}}{{if $unit.Type.UnitGlobalDisabled}} {{$.i18n.Tr "org.team_unit_disabled"}}{{end}}</label>
98
98
<span class="help">{{$.i18n.Tr $unit.DescKey}}</span>
120
120
</tbody>
121
121
</table>
122
122
{{range $t, $unit := $.Units}}
123
- {{if lt $unit.MaxPerms 2}}
123
+ {{if lt $unit.MaxPerm 2}}
124
124
<div {{if $unit.Type.UnitGlobalDisabled}}class="field tooltip" data-content="{{$.i18n.Tr "repo.unit_disabled"}}"{{else}}class="field"{{end}}>
125
125
<div class="ui checkbox">
126
126
<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