gourami

[UNMAINTAINED] Activitypub server in Rust
Log | Files | Refs | README | LICENSE

commit 696391014963a7ee812c52fea50920ef2eafd696
parent b8a24641f3c47b9bcb504e2c7400f3b7112827d0
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Fri,  5 Jun 2020 17:23:22 -0500

Fix remote note IDs

Diffstat:
Msrc/db/note.rs | 6+++---
Msrc/db/user.rs | 7++++---
2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/db/note.rs b/src/db/note.rs @@ -29,7 +29,7 @@ pub struct Note { pub fn get_url(note_id: i32) -> String { // TODO move domain url function - format!("{}/note/{}", SERVER.global_id, note_id) + format!("{}/?note_id={}", SERVER.global_id, note_id) } impl Note { @@ -194,7 +194,7 @@ mod tests { #[test] fn test_user_replace() { let src = "@joe whats up @sally"; - let linked = "<a href=\"/user/joe\">@joe</a> whats up <a href=\"/user/sally\">@sally</a>"; + let linked = "<a href=\"?username=joe\">@joe</a> whats up <a href=\"?username=sally\">@sally</a>"; assert!(parse_note_text(src) == linked) } @@ -202,7 +202,7 @@ mod tests { fn test_note_replace() { let src = "📝123 cool post >>456"; let linked = - "<a href=\"/note/123\">📝123</a> cool post <a href=\"/note/456\">&gt;&gt;456</a>"; + "<a href=\"?note_id=123\">📝123</a> cool post <a href=\"?note_id=456\">&gt;&gt;456</a>"; assert!(parse_note_text(src) == linked) } diff --git a/src/db/user.rs b/src/db/user.rs @@ -4,6 +4,7 @@ use diesel::prelude::*; use diesel::sqlite::SqliteConnection; use serde::Deserialize; use std::env; +use crate::ap::SERVER; #[derive(Debug, Clone, Default, Queryable, Deserialize)] pub struct RegistrationKey { @@ -58,9 +59,9 @@ pub struct User { impl User { pub fn get_url(&self) -> String { format!( - "{}/user/{}", - env::var("GOURAMI_DOMAIN").unwrap(), - self.username + "{}/?user_id={}", + SERVER.global_id, + self.id ) // remote url? }