Extract User::acct_authority() method
This commit is contained in:
parent
10be055381
commit
b2e7664339
@ -832,11 +832,7 @@ impl User {
|
|||||||
|
|
||||||
pub fn webfinger(&self, conn: &Connection) -> Result<Webfinger> {
|
pub fn webfinger(&self, conn: &Connection) -> Result<Webfinger> {
|
||||||
Ok(Webfinger {
|
Ok(Webfinger {
|
||||||
subject: format!(
|
subject: format!("acct:{}", self.acct_authority(conn)?),
|
||||||
"acct:{}@{}",
|
|
||||||
self.username,
|
|
||||||
self.get_instance(conn)?.public_domain
|
|
||||||
),
|
|
||||||
aliases: vec![self.ap_url.clone()],
|
aliases: vec![self.ap_url.clone()],
|
||||||
links: vec![
|
links: vec![
|
||||||
Link {
|
Link {
|
||||||
@ -874,6 +870,14 @@ impl User {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn acct_authority(&self, conn: &Connection) -> Result<String> {
|
||||||
|
Ok(format!(
|
||||||
|
"{}@{}",
|
||||||
|
self.username,
|
||||||
|
self.get_instance(conn)?.public_domain
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_avatar(&self, conn: &Connection, id: i32) -> Result<()> {
|
pub fn set_avatar(&self, conn: &Connection, id: i32) -> Result<()> {
|
||||||
diesel::update(self)
|
diesel::update(self)
|
||||||
.set(users::avatar_id.eq(id))
|
.set(users::avatar_id.eq(id))
|
||||||
|
Loading…
Reference in New Issue
Block a user