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 /pearl.el | |
| 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 'pearl.el')
| -rw-r--r-- | pearl.el | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -1225,10 +1225,14 @@ CONNECTION is an alist with a `nodes' key holding a vector, a list, or nil." (t nil)))) (defun pearl--normalize-user (raw) - "Normalize a Linear user alist RAW to a plist, or nil when RAW is nil." + "Normalize a Linear user alist RAW to a plist, or nil when RAW is nil. +`:display-name' is Linear's short @-mention handle (e.g. \"nerses\"), kept +distinct from `:name' (which can be a full email for users who never set a +display name) so the assignee @-tag can use the short form." (when raw (list :id (cdr (assoc 'id raw)) :name (or (cdr (assoc 'name raw)) (cdr (assoc 'displayName raw))) + :display-name (cdr (assoc 'displayName raw)) :email (cdr (assoc 'email raw))))) (defun pearl--normalize-state (raw) @@ -2497,13 +2501,18 @@ names that slugify to the same tag render it once at the first's position." (defun pearl--assignee-tag (assignee) "Return the @-prefixed Org tag for ASSIGNEE (a normalized user plist), or nil. -Returns nil when ASSIGNEE is nil, `pearl-show-assignee' is off, or the name -slugifies to empty. The slug reuses `pearl--label-name-to-tag'; the `@' prefix -keeps the assignee tag in its own namespace, distinct from label tags, so the -label-edit path can preserve it (see `pearl--set-heading-label-tags'). -Title-sync-safe: Org strips tags before the heading title is hashed." +Returns nil when ASSIGNEE is nil, `pearl-show-assignee' is off, or the handle +slugifies to empty. Slugs the short `:display-name' (Linear's @-mention handle, +e.g. \"nerses\") and falls back to `:name' -- so a teammate whose `:name' is a +full email gets @nerses, not @nerses_deepsat_com. The slug reuses +`pearl--label-name-to-tag'; the `@' prefix keeps the assignee tag in its own +namespace, distinct from label tags, so the label-edit path can preserve it (see +`pearl--set-heading-label-tags'). Title-sync-safe: Org strips tags before the +heading title is hashed." (when (and pearl-show-assignee assignee) - (let ((slug (pearl--label-name-to-tag (plist-get assignee :name)))) + (let ((slug (pearl--label-name-to-tag + (or (plist-get assignee :display-name) + (plist-get assignee :name))))) (unless (string-empty-p slug) (concat "@" slug))))) (defun pearl--derive-todo-line (states) |
