mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Address remaining agent profile review feedback
This commit is contained in:
@@ -910,6 +910,17 @@ fn resolve_legacy_avatar(
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
fn should_skip_legacy_command_avatar(
|
||||
stored_avatar_was_retired_fizz: bool,
|
||||
relay_picture_was_retired_fizz: bool,
|
||||
persona_avatar: Option<&str>,
|
||||
relay_picture: Option<&str>,
|
||||
) -> bool {
|
||||
(stored_avatar_was_retired_fizz || relay_picture_was_retired_fizz)
|
||||
&& persona_avatar.is_none()
|
||||
&& relay_picture.is_none()
|
||||
}
|
||||
|
||||
/// Reconcile an agent's kind:0 profile on the relay.
|
||||
///
|
||||
/// 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(
|
||||
.avatar_url
|
||||
}),
|
||||
);
|
||||
let relay_picture = filter_retired_fizz_avatar(
|
||||
data.persona_id.as_deref(),
|
||||
existing.as_ref().and_then(|info| info.picture.clone()),
|
||||
);
|
||||
let relay_picture_raw = existing.as_ref().and_then(|info| info.picture.clone());
|
||||
let relay_picture_was_retired_fizz = relay_picture_raw
|
||||
.as_deref()
|
||||
.is_some_and(|url| is_retired_fizz_data_url(data.persona_id.as_deref(), url));
|
||||
let relay_picture =
|
||||
filter_retired_fizz_avatar(data.persona_id.as_deref(), relay_picture_raw);
|
||||
|
||||
let skip_command_fallback = stored_avatar_was_retired_fizz
|
||||
&& persona_avatar.is_none()
|
||||
&& relay_picture.is_none();
|
||||
let skip_command_fallback = should_skip_legacy_command_avatar(
|
||||
stored_avatar_was_retired_fizz,
|
||||
relay_picture_was_retired_fizz,
|
||||
persona_avatar.as_deref(),
|
||||
relay_picture.as_deref(),
|
||||
);
|
||||
let backfilled = if skip_command_fallback {
|
||||
String::new()
|
||||
} else {
|
||||
@@ -983,6 +999,7 @@ pub(crate) async fn reconcile_agent_profile(
|
||||
// or clear the retired built-in Fizz data URL if there is no
|
||||
// current profile image to backfill.
|
||||
let should_persist_avatar = stored_avatar_was_retired_fizz
|
||||
|| relay_picture_was_retired_fizz
|
||||
|| (!backfilled.is_empty()
|
||||
&& data.avatar_url.as_deref() != Some(backfilled.as_str()));
|
||||
if should_persist_avatar {
|
||||
|
||||
@@ -196,3 +196,29 @@ fn legacy_avatar_empty_when_nothing_resolves() {
|
||||
|
||||
assert!(resolved.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_avatar_skips_command_icon_for_retired_stored_fizz_avatar() {
|
||||
assert!(should_skip_legacy_command_avatar(true, false, None, None));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_avatar_skips_command_icon_for_retired_relay_fizz_avatar() {
|
||||
assert!(should_skip_legacy_command_avatar(false, true, None, None));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_avatar_keeps_command_icon_when_retired_fizz_has_current_avatar_source() {
|
||||
assert!(!should_skip_legacy_command_avatar(
|
||||
false,
|
||||
true,
|
||||
Some("https://x/persona.png"),
|
||||
None,
|
||||
));
|
||||
assert!(!should_skip_legacy_command_avatar(
|
||||
false,
|
||||
true,
|
||||
None,
|
||||
Some("https://x/relay.png"),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ export function ProfileSummaryView({
|
||||
const { goChannel } = useAppNavigation();
|
||||
const activeTurns = useActiveAgentTurns(isBot ? pubkey : null);
|
||||
|
||||
const showMemoriesIngress = isOwner === true;
|
||||
const showMemoriesIngress = isOwner === true && Boolean(pubkey);
|
||||
const showInstructionIngress =
|
||||
isOwner === true &&
|
||||
(agentInstruction !== null || handleEditPersona !== undefined);
|
||||
|
||||
Reference in New Issue
Block a user