feat(jira): add editable jira_email field per user
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Users can now set a separate Atlassian email for Jira authentication in Settings → Profile → Jira Integration. Falls back to the Aegis account email when not set, so existing setups are unaffected. - Migration b043: adds jira_email column to users table - User model/schema: expose jira_email read/write - jira_service: _effective_jira_email() uses jira_email ?? email - Frontend: replaces read-only email display with editable input Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -121,6 +121,8 @@ export interface UserPreferencesUpdate {
|
||||
notification_preferences?: Partial<NotificationPreferences>;
|
||||
jira_account_id?: string | null;
|
||||
jira_api_token?: string | null;
|
||||
/** Atlassian email used for Jira auth. Overrides Aegis account email. Empty string clears it. */
|
||||
jira_email?: string | null;
|
||||
}
|
||||
|
||||
export interface UserMeOut {
|
||||
@@ -134,6 +136,7 @@ export interface UserMeOut {
|
||||
last_login: string | null;
|
||||
notification_preferences: NotificationPreferences | null;
|
||||
jira_account_id: string | null;
|
||||
jira_email: string | null;
|
||||
jira_token_set: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -816,13 +816,17 @@ function ProfileSection() {
|
||||
});
|
||||
|
||||
const [jiraAccountId, setJiraAccountId] = useState<string>("");
|
||||
const [jiraEmail, setJiraEmail] = useState<string>("");
|
||||
const [jiraApiToken, setJiraApiToken] = useState<string>("");
|
||||
const [showToken, setShowToken] = useState(false);
|
||||
const [dirty, setDirty] = useState(false);
|
||||
const [initialised, setInitialised] = useState(false);
|
||||
|
||||
// Sync from server on load
|
||||
if (me && !dirty && jiraAccountId === "" && me.jira_account_id) {
|
||||
// Sync from server on first load
|
||||
if (me && !initialised) {
|
||||
setJiraAccountId(me.jira_account_id ?? "");
|
||||
setJiraEmail(me.jira_email ?? "");
|
||||
setInitialised(true);
|
||||
}
|
||||
|
||||
const saveMut = useMutation({
|
||||
@@ -839,6 +843,7 @@ function ProfileSection() {
|
||||
const handleSave = () => {
|
||||
const payload: Parameters<typeof updateMyPreferences>[0] = {
|
||||
jira_account_id: jiraAccountId || null,
|
||||
jira_email: jiraEmail || null,
|
||||
};
|
||||
// Only send token if user typed something (empty string clears it)
|
||||
if (jiraApiToken !== "") {
|
||||
@@ -893,14 +898,31 @@ function ProfileSection() {
|
||||
|
||||
<div className="border-t border-gray-800 pt-4">
|
||||
<p className="text-sm font-semibold text-gray-300 mb-1">Jira Integration (personal settings)</p>
|
||||
<p className="text-xs text-gray-500 mb-4 border-b border-gray-800 pb-3">
|
||||
Auth uses your email:{" "}
|
||||
<span className="text-gray-400 font-medium">
|
||||
{me?.email || "— set email in your profile"}
|
||||
</span>
|
||||
<p className="text-xs text-gray-500 mb-4">
|
||||
Configure your personal Atlassian credentials for Jira integration.
|
||||
</p>
|
||||
|
||||
<div className="space-y-4">
|
||||
{/* Jira email */}
|
||||
<div>
|
||||
<label className="mb-1 block text-xs font-medium text-cyan-400">
|
||||
Atlassian / Jira Email
|
||||
</label>
|
||||
<input
|
||||
type="email"
|
||||
value={jiraEmail}
|
||||
onChange={(e) => { setJiraEmail(e.target.value); setDirty(true); }}
|
||||
placeholder={me?.email ?? "your@company.com"}
|
||||
className="w-full rounded-lg border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-gray-200 placeholder-gray-600 focus:border-cyan-500 focus:outline-none"
|
||||
/>
|
||||
<p className="mt-1 text-xs text-gray-600">
|
||||
Email used to authenticate with Atlassian.
|
||||
{me?.email && !me?.jira_email && (
|
||||
<span className="text-gray-500"> Currently using Aegis email: <span className="text-gray-400">{me.email}</span></span>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* API Token */}
|
||||
<div>
|
||||
<label className="mb-1 block text-xs font-medium text-cyan-400">
|
||||
|
||||
Reference in New Issue
Block a user