From 3c89a88e6f8a5ae75784568e866789804a7c0047 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 3 Jun 2026 12:10:09 -0500 Subject: fix(views): slug the assignee @-tag from Linear's displayName handle The assignee @-tag slugged the user's name field, which for a teammate who never set a display name in Linear is their full email. That produced tags like :@first_last_example_com: that wrap the heading's tag line across several lines. Linear's displayName is the short @-mention handle (e.g. "alice", "first.last"), consistent across users where name isn't. I normalize it onto the user as :display-name and slug the tag from it, falling back to name when it's absent. So an email-named teammate becomes :@first_last: and a handle-named one :@alice: instead of :@alice_smith:. The :LINEAR-ASSIGNEE-NAME drawer keeps the fuller name. Every issue query already selects displayName on the assignee, so no fetch change. --- tests/test-pearl-labels.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests') diff --git a/tests/test-pearl-labels.el b/tests/test-pearl-labels.el index 3872f31..94211b1 100644 --- a/tests/test-pearl-labels.el +++ b/tests/test-pearl-labels.el @@ -82,6 +82,27 @@ (should (string= "@eric" (pearl--assignee-tag '(:name "Eric")))) (should (string= "@eric_smith" (pearl--assignee-tag '(:name "Eric Smith"))))) +(ert-deftest test-pearl-assignee-tag-prefers-display-name () + "The tag uses Linear's short displayName (its @-mention handle), not the name +field -- which is the full email for teammates who never set a display name." + (should (string= "@nerses" + (pearl--assignee-tag '(:name "Nerses Ohanyan" :display-name "nerses")))) + (should (string= "@vrezh_mikayelyan" + (pearl--assignee-tag '(:name "vrezh.mikayelyan@deepsat.com" + :display-name "vrezh.mikayelyan"))))) + +(ert-deftest test-pearl-assignee-tag-falls-back-to-name () + "With no displayName, the tag slugs the name." + (should (string= "@eric_bell" (pearl--assignee-tag '(:name "Eric Bell"))))) + +(ert-deftest test-pearl-normalize-user-captures-display-name () + "The normalized user carries Linear's displayName so the @-tag can use the +short handle while the drawer keeps the fuller name." + (let ((u (pearl--normalize-user '((id . "u1") (name . "Nerses Ohanyan") + (displayName . "nerses") (email . "n@x"))))) + (should (string= "nerses" (plist-get u :display-name))) + (should (string= "Nerses Ohanyan" (plist-get u :name))))) + (ert-deftest test-pearl-assignee-tag-nil-when-unassigned () "No assignee yields no tag." (should-not (pearl--assignee-tag nil))) -- cgit v1.2.3