Skip to content

Commit 898828a

Browse files
committed
Treat 0 as a null value for exclusive order.
1 parent d9ea3e4 commit 898828a

File tree

4 files changed

+40
-21
lines changed

4 files changed

+40
-21
lines changed

modules/templates/util_render.go

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ func (ut *RenderUtils) RenderLabel(label *issues_model.Label) template.HTML {
144144
// Scoped label
145145
scopeHTML := ut.RenderEmoji(labelScope)
146146
itemHTML := ut.RenderEmoji(label.Name[len(labelScope)+1:])
147-
orderHTML := ut.RenderEmoji(strconv.Itoa(label.ExclusiveOrder))
148147

149148
// Make scope and item background colors slightly darker and lighter respectively.
150149
// More contrast needed with higher luminance, empirically tweaked.
@@ -172,15 +171,29 @@ func (ut *RenderUtils) RenderLabel(label *issues_model.Label) template.HTML {
172171
itemColor := "#" + hex.EncodeToString(itemBytes)
173172
scopeColor := "#" + hex.EncodeToString(scopeBytes)
174173

175-
return htmlutil.HTMLFormat(`<span class="ui label %s scope-parent" data-tooltip-content title="%s">`+
176-
`<div class="ui label scope-left" style="color: %s !important; background-color: %s !important">%s</div>`+
177-
`<div class="ui label scope-middle" style="color: %s !important; background-color: %s !important">%s</div>`+
178-
`<div class="ui label scope-right">%s</div>`+
179-
`</span>`,
180-
extraCSSClasses, descriptionText,
181-
textColor, scopeColor, scopeHTML,
182-
textColor, itemColor, itemHTML,
183-
orderHTML)
174+
if label.ExclusiveOrder > 0 {
175+
// <scope> | <label> | <order>
176+
orderHTML := ut.RenderEmoji(strconv.Itoa(label.ExclusiveOrder))
177+
return htmlutil.HTMLFormat(`<span class="ui label %s scope-parent" data-tooltip-content title="%s">`+
178+
`<div class="ui label scope-left" style="color: %s !important; background-color: %s !important">%s</div>`+
179+
`<div class="ui label scope-middle" style="color: %s !important; background-color: %s !important">%s</div>`+
180+
`<div class="ui label scope-right">%s</div>`+
181+
`</span>`,
182+
extraCSSClasses, descriptionText,
183+
textColor, scopeColor, scopeHTML,
184+
textColor, itemColor, itemHTML,
185+
orderHTML)
186+
} else {
187+
// <scope> | <label>
188+
return htmlutil.HTMLFormat(`<span class="ui label %s scope-parent" data-tooltip-content title="%s">`+
189+
`<div class="ui label scope-left" style="color: %s !important; background-color: %s !important">%s</div>`+
190+
`<div class="ui label scope-right" style="color: %s !important; background-color: %s !important">%s</div>`+
191+
`</span>`,
192+
extraCSSClasses, descriptionText,
193+
textColor, scopeColor, scopeHTML,
194+
textColor, itemColor, itemHTML,
195+
)
196+
}
184197
}
185198

186199
// RenderEmoji renders html text with emoji post processors

options/label/Advanced.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ labels:
2222
description: Breaking change that won't be backward compatible
2323
- name: "Reviewed/Duplicate"
2424
exclusive: true
25-
exclusive_order: 1
25+
exclusive_order: 2
2626
color: 616161
2727
description: This issue or pull request already exists
2828
- name: "Reviewed/Invalid"
2929
exclusive: true
30-
exclusive_order: 2
30+
exclusive_order: 3
3131
color: 546e7a
3232
description: Invalid issue
3333
- name: "Reviewed/Confirmed"
3434
exclusive: true
35-
exclusive_order: 0
35+
exclusive_order: 1
3636
color: 795548
3737
description: Issue has been confirmed
3838
- name: "Reviewed/Won't Fix"
@@ -42,40 +42,40 @@ labels:
4242
description: This issue won't be fixed
4343
- name: "Status/Need More Info"
4444
exclusive: true
45-
exclusive_order: 1
45+
exclusive_order: 2
4646
color: 424242
4747
description: Feedback is required to reproduce issue or to continue work
4848
- name: "Status/Blocked"
4949
exclusive: true
50-
exclusive_order: 0
50+
exclusive_order: 1
5151
color: 880e4f
5252
description: Something is blocking this issue or pull request
5353
- name: "Status/Abandoned"
5454
exclusive: true
55-
exclusive_order: 2
55+
exclusive_order: 3
5656
color: "222222"
5757
description: Somebody has started to work on this but abandoned work
5858
- name: "Priority/Critical"
5959
exclusive: true
60-
exclusive_order: 0
60+
exclusive_order: 1
6161
color: b71c1c
6262
description: The priority is critical
6363
priority: critical
6464
- name: "Priority/High"
6565
exclusive: true
66-
exclusive_order: 1
66+
exclusive_order: 2
6767
color: d32f2f
6868
description: The priority is high
6969
priority: high
7070
- name: "Priority/Medium"
7171
exclusive: true
72-
exclusive_order: 2
72+
exclusive_order: 3
7373
color: e64a19
7474
description: The priority is medium
7575
priority: medium
7676
- name: "Priority/Low"
7777
exclusive: true
78-
exclusive_order: 3
78+
exclusive_order: 4
7979
color: 4caf50
8080
description: The priority is low
8181
priority: low

routers/web/repo/issue_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ func renderExclusiveLabelScopes(ctx *context.Context) {
483483
scopeSet := make(map[string]bool, 0)
484484
for _, label := range labels {
485485
scope := label.ExclusiveScope()
486-
if len(scope) > 0 {
486+
if len(scope) > 0 && label.ExclusiveOrder > 0 {
487487
scopeSet[scope] = true
488488
}
489489
}

web_src/js/features/comp/LabelEdit.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ export function initCompLabelEdit(pageSelector: string) {
3232
toggleElem(elExclusiveWarning, showExclusiveWarning);
3333
if (!hasScope) elExclusiveInput.checked = false;
3434
toggleElem(elExclusiveOrderField, elExclusiveInput.checked);
35+
36+
if (parseInt(elExclusiveOrderInput.value) <= 0) {
37+
elExclusiveOrderInput.style.color = "var(--color-placeholder-text) !important";
38+
} else {
39+
elExclusiveOrderInput.style.color = null;
40+
}
3541
};
3642

3743
const showLabelEditModal = (btn:HTMLElement) => {

0 commit comments

Comments
 (0)