chore (backend-rs): add misc::emoji submodule
This commit is contained in:
parent
17a9ff6bf1
commit
2a6fb45d66
7 changed files with 13 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
use super::*;
|
||||
use crate::{config::CONFIG, model::entity::emoji};
|
||||
use crate::{model::entity::emoji, misc};
|
||||
use chrono::Utc;
|
||||
|
||||
#[macros::export(object)]
|
||||
|
@ -24,7 +24,7 @@ impl ApEmoji {
|
|||
#[allow(dead_code)] // TODO: remove this line
|
||||
fn new(emoji: emoji::Model) -> Self {
|
||||
Self {
|
||||
id: format!("{}/emojis/{}", CONFIG.url, emoji.name),
|
||||
id: misc::emoji::local_uri(&emoji.name),
|
||||
r#type: ApObject::Emoji,
|
||||
name: format!(":{}:", emoji.name),
|
||||
updated: emoji
|
||||
|
|
9
packages/backend-rs/src/misc/emoji/mod.rs
Normal file
9
packages/backend-rs/src/misc/emoji/mod.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
pub mod emoji;
|
||||
pub mod reaction;
|
||||
|
||||
use crate::config::CONFIG;
|
||||
|
||||
/// Returns URI of a local custom emoji.
|
||||
pub fn local_uri(emoji_code: impl std::fmt::Display) -> String {
|
||||
format!("{}/emojis/{}", CONFIG.url, emoji_code)
|
||||
}
|
|
@ -14,7 +14,6 @@ pub mod note;
|
|||
pub mod nyaify;
|
||||
pub mod password;
|
||||
pub mod random_icon;
|
||||
pub mod reaction;
|
||||
pub mod remove_old_attestation_challenges;
|
||||
pub mod should_nyaify;
|
||||
pub mod system_info;
|
||||
|
|
|
@ -6,6 +6,7 @@ pub mod summarize;
|
|||
|
||||
use crate::config::CONFIG;
|
||||
|
||||
/// Returns URI of a local post.
|
||||
pub fn local_uri(note_id: impl std::fmt::Display) -> String {
|
||||
format!("{}/notes/{}", CONFIG.url, note_id)
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ pub mod count;
|
|||
|
||||
use crate::config::CONFIG;
|
||||
|
||||
/// Returns URI of a local user.
|
||||
pub fn local_uri(user_id: impl std::fmt::Display) -> String {
|
||||
format!("{}/users/{}", CONFIG.url, user_id)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue