Add a page listing people someone follows (#444)
Nothing exceptional, the layout is the same as the followers page. Fixes #325
This commit is contained in:
+2
-1
@@ -54,7 +54,7 @@ use std::process::exit;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
init_i18n!("plume", ar, de, en, fr, gl, it, ja, nb, pl, pt, ru);
|
||||
init_i18n!("plume", ar, de, en, es, fr, gl, it, ja, nb, pl, pt, ru);
|
||||
|
||||
mod api;
|
||||
mod inbox;
|
||||
@@ -187,6 +187,7 @@ Then try to restart Plume.
|
||||
routes::user::dashboard,
|
||||
routes::user::dashboard_auth,
|
||||
routes::user::followers,
|
||||
routes::user::followed,
|
||||
routes::user::edit,
|
||||
routes::user::edit_auth,
|
||||
routes::user::update,
|
||||
|
||||
@@ -28,7 +28,7 @@ pub fn index(conn: DbConn, user: Option<User>, intl: I18n) -> Result<Ructe, Erro
|
||||
let federated = Post::get_recents_page(&*conn, Page::default().limits())?;
|
||||
let local = Post::get_instance_page(&*conn, inst.id, Page::default().limits())?;
|
||||
let user_feed = user.clone().and_then(|user| {
|
||||
let followed = user.get_following(&*conn).ok()?;
|
||||
let followed = user.get_followed(&*conn).ok()?;
|
||||
let mut in_feed = followed.into_iter().map(|u| u.id).collect::<Vec<i32>>();
|
||||
in_feed.push(user.id);
|
||||
Post::user_feed_page(&*conn, in_feed, Page::default().limits()).ok()
|
||||
@@ -62,7 +62,7 @@ pub fn local(conn: DbConn, user: Option<User>, page: Option<Page>, intl: I18n) -
|
||||
#[get("/feed?<page>")]
|
||||
pub fn feed(conn: DbConn, user: User, page: Option<Page>, intl: I18n) -> Result<Ructe, ErrorPage> {
|
||||
let page = page.unwrap_or_default();
|
||||
let followed = user.get_following(&*conn)?;
|
||||
let followed = user.get_followed(&*conn)?;
|
||||
let mut in_feed = followed.into_iter().map(|u| u.id).collect::<Vec<i32>>();
|
||||
in_feed.push(user.id);
|
||||
let articles = Post::user_feed_page(&*conn, in_feed, page.limits())?;
|
||||
|
||||
+19
-1
@@ -161,7 +161,7 @@ pub fn follow(name: String, conn: DbConn, user: User, worker: Worker) -> Result<
|
||||
#[post("/@/<name>/follow", rank = 2)]
|
||||
pub fn follow_auth(name: String, i18n: I18n) -> Flash<Redirect> {
|
||||
utils::requires_login(
|
||||
&i18n!(i18n.catalog, "You need to be logged in order to follow someone"),
|
||||
&i18n!(i18n.catalog, "You need to be logged in order to subscribe to someone"),
|
||||
uri!(follow: name = name),
|
||||
)
|
||||
}
|
||||
@@ -184,6 +184,24 @@ pub fn followers(name: String, conn: DbConn, account: Option<User>, page: Option
|
||||
)))
|
||||
}
|
||||
|
||||
#[get("/@/<name>/followed?<page>", rank = 2)]
|
||||
pub fn followed(name: String, conn: DbConn, account: Option<User>, page: Option<Page>, intl: I18n) -> Result<Ructe, ErrorPage> {
|
||||
let page = page.unwrap_or_default();
|
||||
let user = User::find_by_fqn(&*conn, &name)?;
|
||||
let followed_count = user.count_followed(&*conn)?;
|
||||
|
||||
Ok(render!(users::followed(
|
||||
&(&*conn, &intl.catalog, account.clone()),
|
||||
user.clone(),
|
||||
account.and_then(|x| x.is_following(&*conn, user.id).ok()).unwrap_or(false),
|
||||
user.instance_id != Instance::get_local(&*conn)?.id,
|
||||
user.get_instance(&*conn)?.public_domain,
|
||||
user.get_followed_page(&*conn, page.limits())?,
|
||||
page.0,
|
||||
Page::total(followed_count as i32)
|
||||
)))
|
||||
}
|
||||
|
||||
#[get("/@/<name>", rank = 1)]
|
||||
pub fn activity_details(
|
||||
name: String,
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn translate_notification(ctx: BaseContext, notif: Notification) -> String {
|
||||
let name = notif.get_actor(ctx.0).unwrap().name(ctx.0);
|
||||
match notif.kind.as_ref() {
|
||||
notification_kind::COMMENT => i18n!(ctx.1, "{0} commented your article."; &name),
|
||||
notification_kind::FOLLOW => i18n!(ctx.1, "{0} is now following you."; &name),
|
||||
notification_kind::FOLLOW => i18n!(ctx.1, "{0} is subscribed to you."; &name),
|
||||
notification_kind::LIKE => i18n!(ctx.1, "{0} liked your article."; &name),
|
||||
notification_kind::MENTION => i18n!(ctx.1, "{0} mentioned you."; &name),
|
||||
notification_kind::RESHARE => i18n!(ctx.1, "{0} boosted your article."; &name),
|
||||
|
||||
Reference in New Issue
Block a user