19 lines
899 B
TypeScript
19 lines
899 B
TypeScript
import type { JiraIssue } from '../types/jira'
|
|
import type { DashboardConfig } from './dashboardConfig'
|
|
|
|
/** Correspondance utilisateur « Ma vue » : compte Atlassian ou e-mail. */
|
|
export function assigneeMatchesMyView(issue: JiraIssue, cfg: DashboardConfig): boolean {
|
|
const a = issue.fields.assignee
|
|
if (!a) return false
|
|
const cfgId = cfg.myJiraAccountId?.trim()
|
|
const cfgEmail = cfg.myJiraEmail?.trim().toLowerCase()
|
|
const envId = import.meta.env.VITE_MY_JIRA_ACCOUNT_ID?.trim()
|
|
const envEmail = import.meta.env.VITE_MY_JIRA_EMAIL?.trim().toLowerCase()
|
|
|
|
if (cfgId && a.accountId && a.accountId === cfgId) return true
|
|
if (envId && a.accountId && a.accountId === envId) return true
|
|
if (cfgEmail && a.emailAddress && a.emailAddress.toLowerCase() === cfgEmail) return true
|
|
if (envEmail && a.emailAddress && a.emailAddress.toLowerCase() === envEmail) return true
|
|
return false
|
|
}
|