diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-03 12:10:09 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-03 12:10:09 -0500 |
| commit | 3c89a88e6f8a5ae75784568e866789804a7c0047 (patch) | |
| tree | 93df423748dd29690763be5d0c674689b4bc3f60 /tests | |
| parent | cb73a13c85c9818979f21e5ca0fd6aee631fb61e (diff) | |
| download | pearl-3c89a88e6f8a5ae75784568e866789804a7c0047.tar.gz pearl-3c89a88e6f8a5ae75784568e866789804a7c0047.zip | |
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.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-pearl-labels.el | 21 |
1 files changed, 21 insertions, 0 deletions
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))) |
