~vpzom/lotide

79834fdd3bd9da63f130d2a3a958a19e5e41246c — Colin Reeder 4 days ago fa2c174
Resolve some lint warnings
M src/apub_util.rs => src/apub_util.rs +4 -4
@@ 2,7 2,7 @@ use crate::{BaseURL, CommentLocalID, CommunityLocalID, PostLocalID, ThingLocalRe
use activitystreams::prelude::*;
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use std::convert::{TryFrom, TryInto};
use std::convert::TryFrom;
use std::ops::Deref;
use std::sync::Arc;



@@ 713,7 713,7 @@ pub fn local_community_post_announce_ap(
        .set_to({
            let mut res = community_ap_id;
            res.path_segments_mut().push("followers");
            BaseURL::from(res)
            res
        })
        .set_cc(activitystreams::public());



@@ 1344,7 1344,7 @@ pub async fn handle_recieved_object_for_local_community<'a>(
                    }

                    handle_recieved_reply(
                        obj_id.try_into()?,
                        obj_id,
                        content.unwrap_or(""),
                        media_type,
                        created.as_ref(),


@@ 1635,7 1635,7 @@ async fn handle_recieved_reply(
                        content_text: content_text.map(|x| Cow::Owned(x.to_owned())),
                        content_markdown: None,
                        content_html: content_html.map(|x| Cow::Owned(x.to_owned())),
                        created: created.map(|x| *x).unwrap_or_else(|| {
                        created: created.copied().unwrap_or_else(|| {
                            chrono::offset::Utc::now()
                                .with_timezone(&chrono::offset::FixedOffset::west(0))
                        }),

M src/main.rs => src/main.rs +3 -4
@@ 449,7 449,7 @@ pub fn get_lang_for_req(req: &hyper::Request<hyper::Body>) -> Translator {
        None => vec![&default],
    };

    let mut bundle = fluent::concurrent::FluentBundle::new(languages.iter().map(|x| *x));
    let mut bundle = fluent::concurrent::FluentBundle::new(languages.iter().copied());
    for lang in languages {
        if let Err(errors) = bundle.add_resource(&LANG_MAP[lang]) {
            for err in errors {


@@ 565,7 565,7 @@ pub fn on_post_add_comment(comment: CommentInfo<'static>, ctx: Arc<crate::RouteC
            )
            .map_err(crate::Error::from),
            async {
                let res: Result<Option<(BaseURL, Option<BaseURL>, bool, Option<UserLocalID>)>, crate::Error> = match comment.parent {
                match comment.parent {
                    Some(parent) => {
                        let row = db.query_one(
                            "SELECT reply.local, reply.ap_id, person.id, person.ap_id FROM reply LEFT OUTER JOIN person ON (person.id = reply.author) WHERE reply.id=$1",


@@ 581,8 581,7 @@ pub fn on_post_add_comment(comment: CommentInfo<'static>, ctx: Arc<crate::RouteC
                        }
                    },
                    None => Ok(None),
                };
                res
                }
            }
        ).await?;


M src/routes/api/comments.rs => src/routes/api/comments.rs +1 -1
@@ 111,7 111,7 @@ async fn route_unstable_comments_get(
                    },

                    author,
                    created: created.to_rfc3339().into(),
                    created: created.to_rfc3339(),
                    deleted: row.get(10),
                    has_replies: !replies.is_empty(),
                    replies: Some(replies),

M src/routes/api/mod.rs => src/routes/api/mod.rs +1 -1
@@ 616,7 616,7 @@ async fn get_comments_replies<'a>(
                    },

                    author,
                    created: created.to_rfc3339().into(),
                    created: created.to_rfc3339(),
                    deleted: row.get(9),
                    replies: None,
                    has_replies: false,

M src/routes/api/posts.rs => src/routes/api/posts.rs +2 -2
@@ 69,7 69,7 @@ async fn get_post_comments<'a>(
                    },

                    author,
                    created: created.to_rfc3339().into(),
                    created: created.to_rfc3339(),
                    deleted: row.get(8),
                    replies: None,
                    has_replies: false,


@@ 153,7 153,7 @@ async fn route_unstable_posts_create(
    }

    if let Some(href) = &body.href {
        if let Err(_) = url::Url::parse(href) {
        if url::Url::parse(href).is_err() {
            return Err(crate::Error::UserError(crate::simple_response(
                hyper::StatusCode::BAD_REQUEST,
                lang.tr("post_href_invalid", None).into_owned(),

M src/routes/apub/mod.rs => src/routes/apub/mod.rs +1 -4
@@ 478,8 478,6 @@ async fn handler_users_outbox_page_get(
                last_created = Some(created);
                res
            } else {
                use std::convert::TryInto;

                let id = CommentLocalID(row.get(1));
                let post_id = PostLocalID(row.get(8));
                let parent_id = row.get::<_, Option<_>>(11).map(CommentLocalID);


@@ 531,8 529,7 @@ async fn handler_users_outbox_page_get(
                        std::str::FromStr::from_str(row.get(17))?
                    },
                    &ctx.host_url_apub,
                )
                .and_then(|x| Ok(x.try_into()?));
                );

                last_created = Some(created);
                res