fix(profile): cards of people from other organizations show their presence
Graph answers 404 for people outside the signed-in tenant, so their profile card only showed "Profile details could not be loaded". Like Teams, the card now builds without directory details and still shows availability, status note and out of office from presence.
@@ -70,7 +70,20 @@ impl PersonProfile {
70
70
}
71
71
72
72
pub(crate) async fn load_profile(graph: &Graph, user_id: &str) -> Result<PersonProfile> {
73
let details = graph.user_profile(user_id).await?;
73
let details = match graph.user_profile(user_id).await {
74
Ok(details) => details,
75
// People from other organizations are not in this directory. Like Teams, their card
76
// still shows what presence knows: availability, status note and out of office.
77
Err(graph::Error::Session(session::Error::Api { status: 404, .. })) => ProfileDetails {
78
user: graph::UserProfile {
79
id: user_id.to_owned(),
80
..Default::default()
81
},
82
manager: None,
83
direct_reports: Vec::new(),
84
},
85
Err(error) => return Err(error.into()),
86
};
74
87
let mail = details
75
88
.user
76
89
.mail
@@ -70,7 +70,20 @@ impl PersonProfile {70
}70
}71
71
72
pub(crate) async fn load_profile(graph: &Graph, user_id: &str) -> Result<PersonProfile> {72
pub(crate) async fn load_profile(graph: &Graph, user_id: &str) -> Result<PersonProfile> {73
let details = graph.user_profile(user_id).await?;73
let details = match graph.user_profile(user_id).await {74
Ok(details) => details,75
// People from other organizations are not in this directory. Like Teams, their card76
// still shows what presence knows: availability, status note and out of office.77
Err(graph::Error::Session(session::Error::Api { status: 404, .. })) => ProfileDetails {78
user: graph::UserProfile {79
id: user_id.to_owned(),80
..Default::default()81
},82
manager: None,83
direct_reports: Vec::new(),84
},85
Err(error) => return Err(error.into()),86
};74
let mail = details87
let mail = details75
.user88
.user76
.mail89
.mail