Skip to content

Commit

Permalink
fix(zendesk): Include ticket id in description (#1996)
Browse files Browse the repository at this point in the history
Closes #1995
  • Loading branch information
rylek90 committed Nov 23, 2021
1 parent 36d68cc commit c28f1f3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/scripts/content/zendesk.js
Expand Up @@ -11,8 +11,20 @@ togglbutton.render(
};

const getDescription = () => {
// what a monster
// TODO: include?.optional?.chaining?.asap
const ticketId =
elem.parentElement &&
elem.parentElement.parentElement &&
elem.parentElement.parentElement.dataset &&
elem.parentElement.parentElement.dataset.ticketId
? `# ${elem.parentElement.parentElement.dataset.ticketId}`
: '';

const input = elem.querySelector('[class^=styles__Left] input');
return (input ? input.value : '').trim();
const title = (input ? input.value : '').trim();

return [ticketId, title].filter(Boolean).join(' ');
};

const link = togglbutton.createTimerLink({
Expand Down

0 comments on commit c28f1f3

Please sign in to comment.