From b2e76643398c7b1731b584eae63eefbe8a6d27dd Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 14 Feb 2021 22:14:44 +0900 Subject: [PATCH] Extract User::acct_authority() method --- plume-models/src/users.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index 0b7cf3af..95b4d758 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -832,11 +832,7 @@ impl User { pub fn webfinger(&self, conn: &Connection) -> Result { Ok(Webfinger { - subject: format!( - "acct:{}@{}", - self.username, - self.get_instance(conn)?.public_domain - ), + subject: format!("acct:{}", self.acct_authority(conn)?), aliases: vec![self.ap_url.clone()], links: vec![ Link { @@ -874,6 +870,14 @@ impl User { }) } + pub fn acct_authority(&self, conn: &Connection) -> Result { + Ok(format!( + "{}@{}", + self.username, + self.get_instance(conn)?.public_domain + )) + } + pub fn set_avatar(&self, conn: &Connection, id: i32) -> Result<()> { diesel::update(self) .set(users::avatar_id.eq(id))