Merge pull request #283 from Plume-org/hashtags

Support hashtags
This commit is contained in:
Baptiste Gelez
2018-10-21 13:53:15 +01:00
committed by GitHub
20 changed files with 215 additions and 66 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ impl Comment {
}
pub fn into_activity(&self, conn: &Connection) -> Note {
let (html, mentions) = utils::md_to_html(self.content.get().as_ref());
let (html, mentions, _hashtags) = utils::md_to_html(self.content.get().as_ref());
let author = User::get(conn, self.author_id).expect("Comment::into_activity: author error");
let mut note = Note::default();
+2 -2
View File
@@ -117,8 +117,8 @@ impl Instance {
}
pub fn update(&self, conn: &Connection, name: String, open_registrations: bool, short_description: SafeString, long_description: SafeString) {
let (sd, _) = md_to_html(short_description.as_ref());
let (ld, _) = md_to_html(long_description.as_ref());
let (sd, _, _) = md_to_html(short_description.as_ref());
let (ld, _, _) = md_to_html(long_description.as_ref());
diesel::update(self)
.set((
instances::name.eq(name),
+1 -1
View File
@@ -144,7 +144,7 @@ table! {
tags (id) {
id -> Int4,
tag -> Text,
is_hastag -> Bool,
is_hashtag -> Bool,
post_id -> Int4,
}
}
+3 -3
View File
@@ -9,7 +9,7 @@ use schema::tags;
pub struct Tag {
pub id: i32,
pub tag: String,
pub is_hastag: bool,
pub is_hashtag: bool,
pub post_id: i32
}
@@ -17,7 +17,7 @@ pub struct Tag {
#[table_name = "tags"]
pub struct NewTag {
pub tag: String,
pub is_hastag: bool,
pub is_hashtag: bool,
pub post_id: i32
}
@@ -40,7 +40,7 @@ impl Tag {
pub fn from_activity(conn: &Connection, tag: Hashtag, post: i32) -> Tag {
Tag::insert(conn, NewTag {
tag: tag.name_string().expect("Tag::from_activity: name error"),
is_hastag: false,
is_hashtag: false,
post_id: post
})
}