From fa5f61967aa4b40352fe55bd5a2718e07790b0df Mon Sep 17 00:00:00 2001 From: Rebecca Mahany-Horton Date: Fri, 12 Jan 2024 12:51:50 -0500 Subject: [PATCH 1/2] Add circleDot capability --- ee/desktop/user/menu/menu_template.go | 5 ++++- ee/desktop/user/menu/menu_template_test.go | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ee/desktop/user/menu/menu_template.go b/ee/desktop/user/menu/menu_template.go index 73b885919..5a49e0d15 100644 --- a/ee/desktop/user/menu/menu_template.go +++ b/ee/desktop/user/menu/menu_template.go @@ -8,13 +8,14 @@ import ( ) const ( - CurrentMenuVersion string = "0.1.0" // Bump menu version when major changes occur to the TemplateData format + CurrentMenuVersion string = "0.1.1" // Bump menu version when major changes occur to the TemplateData format // Capabilities queriable via hasCapability funcHasCapability = "hasCapability" funcRelativeTime = "relativeTime" errorlessTemplateVars = "errorlessTemplateVars" // capability to evaluate undefined template vars without failing errorlessActions = "errorlessActions" // capability to evaluate undefined menu item actions without failing + circleDot = "circleDot" // capability to use circle-dot icon // TemplateData keys LauncherVersion string = "LauncherVersion" @@ -56,6 +57,8 @@ func (tp *templateParser) Parse(text string) (string, error) { return true case errorlessActions: return true + case circleDot: + return true } return false }, diff --git a/ee/desktop/user/menu/menu_template_test.go b/ee/desktop/user/menu/menu_template_test.go index 10914696b..9ea62bb2c 100644 --- a/ee/desktop/user/menu/menu_template_test.go +++ b/ee/desktop/user/menu/menu_template_test.go @@ -43,6 +43,18 @@ func Test_Parse(t *testing.T) { text: "This capability is {{if hasCapability `bad capability`}}supported{{else}}unsupported{{end}}.", output: "This capability is unsupported.", }, + { + name: "circleDot capability", + td: &TemplateData{}, + text: "\"icon\":\"{{if not (hasCapability `circleDot`)}}triangle-exclamation{{else}}circle-dot{{end}}\"", + output: "\"icon\":\"circle-dot\"", + }, + { + name: "icon fallback capability", + td: &TemplateData{}, + text: "\"icon\":\"{{if not (hasCapability `asOfYetUnknownIconType`)}}triangle-exclamation{{else}}new-icon-type{{end}}\"", + output: "\"icon\":\"triangle-exclamation\"", + }, { name: "relativeTime 2 hours ago", td: &TemplateData{LastMenuUpdateTime: time.Now().Add(-2 * time.Hour).Unix()}, From 8c7adb6c8a201b752087e859b350c82519a86a72 Mon Sep 17 00:00:00 2001 From: Rebecca Mahany-Horton Date: Fri, 12 Jan 2024 12:58:27 -0500 Subject: [PATCH 2/2] Don't bump menu version --- ee/desktop/user/menu/menu_template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/desktop/user/menu/menu_template.go b/ee/desktop/user/menu/menu_template.go index 5a49e0d15..8ae356bc2 100644 --- a/ee/desktop/user/menu/menu_template.go +++ b/ee/desktop/user/menu/menu_template.go @@ -8,7 +8,7 @@ import ( ) const ( - CurrentMenuVersion string = "0.1.1" // Bump menu version when major changes occur to the TemplateData format + CurrentMenuVersion string = "0.1.0" // Bump menu version when major changes occur to the TemplateData format // Capabilities queriable via hasCapability funcHasCapability = "hasCapability"