Skip to content

Commit 7bd453b

Browse files
committed
Address remaining agent profile review feedback
1 parent c25fa65 commit 7bd453b

3 files changed

Lines changed: 51 additions & 8 deletions

File tree

desktop/src-tauri/src/commands/agents.rs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,17 @@ fn resolve_legacy_avatar(
910910
.unwrap_or_default()
911911
}
912912

913+
fn should_skip_legacy_command_avatar(
914+
stored_avatar_was_retired_fizz: bool,
915+
relay_picture_was_retired_fizz: bool,
916+
persona_avatar: Option<&str>,
917+
relay_picture: Option<&str>,
918+
) -> bool {
919+
(stored_avatar_was_retired_fizz || relay_picture_was_retired_fizz)
920+
&& persona_avatar.is_none()
921+
&& relay_picture.is_none()
922+
}
923+
913924
/// Reconcile an agent's kind:0 profile on the relay.
914925
///
915926
/// Queries the relay for the agent's existing profile and re-publishes if missing
@@ -965,14 +976,19 @@ pub(crate) async fn reconcile_agent_profile(
965976
.avatar_url
966977
}),
967978
);
968-
let relay_picture = filter_retired_fizz_avatar(
969-
data.persona_id.as_deref(),
970-
existing.as_ref().and_then(|info| info.picture.clone()),
979+
let relay_picture_raw = existing.as_ref().and_then(|info| info.picture.clone());
980+
let relay_picture_was_retired_fizz = relay_picture_raw
981+
.as_deref()
982+
.is_some_and(|url| is_retired_fizz_data_url(data.persona_id.as_deref(), url));
983+
let relay_picture =
984+
filter_retired_fizz_avatar(data.persona_id.as_deref(), relay_picture_raw);
985+
986+
let skip_command_fallback = should_skip_legacy_command_avatar(
987+
stored_avatar_was_retired_fizz,
988+
relay_picture_was_retired_fizz,
989+
persona_avatar.as_deref(),
990+
relay_picture.as_deref(),
971991
);
972-
973-
let skip_command_fallback = stored_avatar_was_retired_fizz
974-
&& persona_avatar.is_none()
975-
&& relay_picture.is_none();
976992
let backfilled = if skip_command_fallback {
977993
String::new()
978994
} else {
@@ -983,6 +999,7 @@ pub(crate) async fn reconcile_agent_profile(
983999
// or clear the retired built-in Fizz data URL if there is no
9841000
// current profile image to backfill.
9851001
let should_persist_avatar = stored_avatar_was_retired_fizz
1002+
|| relay_picture_was_retired_fizz
9861003
|| (!backfilled.is_empty()
9871004
&& data.avatar_url.as_deref() != Some(backfilled.as_str()));
9881005
if should_persist_avatar {

desktop/src-tauri/src/commands/agents_tests.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,29 @@ fn legacy_avatar_empty_when_nothing_resolves() {
196196

197197
assert!(resolved.is_empty());
198198
}
199+
200+
#[test]
201+
fn legacy_avatar_skips_command_icon_for_retired_stored_fizz_avatar() {
202+
assert!(should_skip_legacy_command_avatar(true, false, None, None));
203+
}
204+
205+
#[test]
206+
fn legacy_avatar_skips_command_icon_for_retired_relay_fizz_avatar() {
207+
assert!(should_skip_legacy_command_avatar(false, true, None, None));
208+
}
209+
210+
#[test]
211+
fn legacy_avatar_keeps_command_icon_when_retired_fizz_has_current_avatar_source() {
212+
assert!(!should_skip_legacy_command_avatar(
213+
false,
214+
true,
215+
Some("https://x/persona.png"),
216+
None,
217+
));
218+
assert!(!should_skip_legacy_command_avatar(
219+
false,
220+
true,
221+
None,
222+
Some("https://x/relay.png"),
223+
));
224+
}

desktop/src/features/profile/ui/UserProfilePanelSections.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export function ProfileSummaryView({
158158
const { goChannel } = useAppNavigation();
159159
const activeTurns = useActiveAgentTurns(isBot ? pubkey : null);
160160

161-
const showMemoriesIngress = isOwner === true;
161+
const showMemoriesIngress = isOwner === true && Boolean(pubkey);
162162
const showInstructionIngress =
163163
isOwner === true &&
164164
(agentInstruction !== null || handleEditPersona !== undefined);

0 commit comments

Comments
 (0)