Support displaying shortcodes instead of Emojis in messages (#222)

This commit is contained in:
Bernhard Bliem 2024-03-24 00:35:10 +01:00 committed by GitHub
parent 0c52375e06
commit 23a729e565
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 164 additions and 49 deletions

View file

@ -469,6 +469,7 @@ impl SortOverrides {
#[derive(Clone)]
pub struct TunableValues {
pub log_level: Level,
pub message_shortcode_display: bool,
pub reaction_display: bool,
pub reaction_shortcode_display: bool,
pub read_receipt_send: bool,
@ -489,6 +490,7 @@ pub struct TunableValues {
#[derive(Clone, Default, Deserialize)]
pub struct Tunables {
pub log_level: Option<LogLevel>,
pub message_shortcode_display: Option<bool>,
pub reaction_display: Option<bool>,
pub reaction_shortcode_display: Option<bool>,
pub read_receipt_send: Option<bool>,
@ -511,6 +513,9 @@ impl Tunables {
fn merge(self, other: Self) -> Self {
Tunables {
log_level: self.log_level.or(other.log_level),
message_shortcode_display: self
.message_shortcode_display
.or(other.message_shortcode_display),
reaction_display: self.reaction_display.or(other.reaction_display),
reaction_shortcode_display: self
.reaction_shortcode_display
@ -534,6 +539,7 @@ impl Tunables {
fn values(self) -> TunableValues {
TunableValues {
log_level: self.log_level.map(Level::from).unwrap_or(Level::INFO),
message_shortcode_display: self.message_shortcode_display.unwrap_or(false),
reaction_display: self.reaction_display.unwrap_or(true),
reaction_shortcode_display: self.reaction_shortcode_display.unwrap_or(false),
read_receipt_send: self.read_receipt_send.unwrap_or(true),