~vpzom/hitide

371a0e8aded22869ad1ec352125a81f121150fb8 — Colin Reeder 1 year, 2 months ago 296ae69
Add link to source for remote actors
4 files changed, 41 insertions(+), 3 deletions(-)

M res/main.css
M src/resp_types.rs
M src/routes/communities.rs
M src/routes/mod.rs
M res/main.css => res/main.css +9 -2
@@ 29,14 29,21 @@ body {
	margin-right: 1em;
}

.errorBox {
	background-color: #FF6D00;
.errorBox, .infoBox {
	padding: .5em;
	display: inline-block;
	margin-top: .5em;
	margin-bottom: .5em;
}

.errorBox {
	background-color: #FF6D00;
}

.infoBox {
	background-color: #80D8FF;
}

.communitySidebar {
	float: right;
	width: 300px;

M src/resp_types.rs => src/resp_types.rs +2 -0
@@ 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)]

M src/routes/communities.rs => src/routes/communities.rs +15 -1
@@ 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() {

M src/routes/mod.rs => src/routes/mod.rs +15 -0
@@ 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 {