init
This commit is contained in:
18
src/lib/assigneeMatch.ts
Normal file
18
src/lib/assigneeMatch.ts
Normal file
@ -0,0 +1,18 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user