diff options
author | Colin Reeder <colin@vpzom.click> | 2020-07-19 09:49:44 -0600 |
---|---|---|
committer | Colin Reeder <colin@vpzom.click> | 2020-07-19 09:49:44 -0600 |
commit | 371a0e8aded22869ad1ec352125a81f121150fb8 (patch) | |
tree | e37c7316300e3f630076601ececd33ac33e7b20f /src | |
parent | 296ae699a3cd65000e4fdb10198807e4485e5682 (diff) |
Add link to source for remote actors
Diffstat (limited to 'src')
-rw-r--r-- | src/resp_types.rs | 2 | ||||
-rw-r--r-- | src/routes/communities.rs | 16 | ||||
-rw-r--r-- | src/routes/mod.rs | 15 |
3 files changed, 32 insertions, 1 deletions
diff --git a/src/resp_types.rs b/src/resp_types.rs index c2d91f3..e24b303 100644 --- a/src/resp_types.rs +++ b/src/resp_types.rs @@ -7,6 +7,7 @@ pub struct RespMinimalAuthorInfo<'a> { pub username: Cow<'a, str>, pub local: bool, pub host: Cow<'a, str>, + pub remote_url: Option<Cow<'a, str>>, } #[derive(Deserialize, Debug)] @@ -92,6 +93,7 @@ pub struct RespMinimalCommunityInfo<'a> { pub name: Cow<'a, str>, pub local: bool, pub host: Cow<'a, str>, + pub remote_url: Option<Cow<'a, str>>, } #[derive(Deserialize, Debug)] diff --git a/src/routes/communities.rs b/src/routes/communities.rs index 6e29f6d..e4b1f13 100644 --- a/src/routes/communities.rs +++ b/src/routes/communities.rs @@ -144,7 +144,21 @@ async fn page_community( <HTPage base_data={&base_data} title> <div class={"communitySidebar"}> <h2>{title}</h2> - <em>{format!("@{}@{}", community_info.as_ref().name, community_info.as_ref().host)}</em> + <div><em>{format!("@{}@{}", community_info.as_ref().name, community_info.as_ref().host)}</em></div> + { + if community_info.as_ref().local { + None + } else if let Some(remote_url) = &community_info.as_ref().remote_url { + Some(render::rsx! { + <div class={"infoBox"}> + {"This is a remote community, information on this page may be incomplete. "} + <a href={remote_url.as_ref()}>{"View at Source ↗"}</a> + </div> + }) + } else { + None // shouldn't ever happen + } + } <p> { if base_data.login.is_some() { diff --git a/src/routes/mod.rs b/src/routes/mod.rs index e046830..6a38e2c 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -933,6 +933,21 @@ async fn page_user( Ok(html_response(render::html! { <HTPage base_data={&base_data} title> <h1>{title}</h1> + <div><em>{format!("@{}@{}", user.as_ref().username, user.as_ref().host)}</em></div> + { + if user.as_ref().local { + None + } else if let Some(remote_url) = &user.as_ref().remote_url { + Some(render::rsx! { + <div class={"infoBox"}> + {"This is a remote user, information on this page may be incomplete. "} + <a href={remote_url.as_ref()}>{"View at Source ↗"}</a> + </div> + }) + } else { + None // shouldn't ever happen + } + } { if let Some(login) = &base_data.login { if login.user.id == user_id { |