diff --git a/crates/app/src/public/html/components.html b/crates/app/src/public/html/components.html index a44b0bd..7fdb179 100644 --- a/crates/app/src/public/html/components.html +++ b/crates/app/src/public/html/components.html @@ -1148,7 +1148,10 @@ secondary=false) -%} .querySelector("emoji-picker") .addEventListener("emoji-click", (event) => { function gemoji() { - const use_first_shortcode = ["grinning squinting face"]; + const use_first_shortcode = [ + "grinning squinting face", + "smiling_face_with_heart_eyes", + ]; if ( use_first_shortcode.includes( diff --git a/crates/core/src/database/drivers/sql/create_emojis.sql b/crates/core/src/database/drivers/sql/create_emojis.sql index 57d8890..6a79e56 100644 --- a/crates/core/src/database/drivers/sql/create_emojis.sql +++ b/crates/core/src/database/drivers/sql/create_emojis.sql @@ -4,5 +4,6 @@ CREATE TABLE IF NOT EXISTS emojis ( owner BIGINT NOT NULL, community BIGINT NOT NULL, upload_id BIGINT NOT NULL, - name TEXT NOT NULL + name TEXT NOT NULL, + is_animated INT NOT NULL ) diff --git a/crates/core/src/database/emojis.rs b/crates/core/src/database/emojis.rs index 9e13332..8f4d209 100644 --- a/crates/core/src/database/emojis.rs +++ b/crates/core/src/database/emojis.rs @@ -25,6 +25,7 @@ impl DataManager { community: get!(x->3(i64)) as usize, upload_id: get!(x->4(i64)) as usize, name: get!(x->5(String)), + is_animated: get!(x->6(i32)) as i8 == 1, } } @@ -125,14 +126,15 @@ impl DataManager { let res = execute!( &conn, - "INSERT INTO emojis VALUES ($1, $2, $3, $4, $5, $6)", + "INSERT INTO emojis VALUES ($1, $2, $3, $4, $5, $6, $7)", params![ &(data.id as i64), &(data.owner as i64), &(data.created as i64), &(data.community as i64), &(data.upload_id as i64), - &data.name + &data.name, + &{ if data.is_animated { 1 } else { 0 } }, ] ); diff --git a/crates/core/src/model/uploads.rs b/crates/core/src/model/uploads.rs index a94dfec..f4c76a7 100644 --- a/crates/core/src/model/uploads.rs +++ b/crates/core/src/model/uploads.rs @@ -46,13 +46,20 @@ pub struct CustomEmoji { pub community: usize, pub upload_id: usize, pub name: String, + pub is_animated: bool, } pub type EmojiParserResult = Vec<(String, usize, String)>; impl CustomEmoji { /// Create a new [`CustomEmoji`]. - pub fn new(owner: usize, community: usize, upload_id: usize, name: String) -> Self { + pub fn new( + owner: usize, + community: usize, + upload_id: usize, + name: String, + is_animated: bool, + ) -> Self { Self { id: AlmostSnowflake::new(1234567890) .to_string() @@ -63,6 +70,7 @@ impl CustomEmoji { community, upload_id, name, + is_animated, } }