Skip to content

Commit

Permalink
Debounce notify events and replace askama with sailfish (#614)
Browse files Browse the repository at this point in the history
* debounce notify events

* replace askama

* delete sass file
  • Loading branch information
aumetra authored Nov 30, 2024
1 parent 7aa9060 commit 5de2359
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 312 deletions.
153 changes: 94 additions & 59 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ members = [
resolver = "2"

[workspace.dependencies]
askama = { version = "0.12.1", default-features = false }
asynk-strim = "0.1.2"
clap = { version = "4.5.21", features = ["derive", "wrap_help"] }
diesel = { version = "2.2.5", default-features = false, features = [
Expand Down Expand Up @@ -116,6 +115,10 @@ iso8601-timestamp = "0.3.1"
itertools = { version = "0.13.0", default-features = false }
minijinja = { version = "2.5.0", features = ["loader"] }
moka = { version = "=0.12.7", features = ["sync"] }
sailfish = { version = "0.9.0", default-features = false, features = [
"derive",
"perf-inline",
] }
simdutf8 = { version = "0.1.5", features = ["aarch64_neon"] }
sonic-rs = "=0.3.14"
tokio = "1.41.1"
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-email/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ version.workspace = true
license.workspace = true

[dependencies]
askama.workspace = true
diesel.workspace = true
diesel-async.workspace = true
kitsune-db.workspace = true
Expand All @@ -26,6 +25,7 @@ mrml = { version = "4.0.1", default-features = false, features = [
"parse",
"render",
] }
sailfish.workspace = true
speedy-uuid.workspace = true
triomphe.workspace = true
typed-builder = "0.20.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/kitsune-email/src/mails/confirm_account.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::traits::{RenderableEmail, RenderedEmail};
use askama::Template;
use kitsune_error::Result;
use mrml::{mjml::Mjml, prelude::render::RenderOptions};
use sailfish::Template;
use typed_builder::TypedBuilder;

#[derive(Template, TypedBuilder)]
#[template(escape = "html", path = "verify.mjml")]
#[template(path = "verify.mjml")]
pub struct ConfirmAccount<'a> {
domain: &'a str,
username: &'a str,
Expand Down
29 changes: 14 additions & 15 deletions crates/kitsune-email/templates/verify.mjml
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
<mjml>
<mj-head>
<mj-title>Confirm your {{domain}} account</mj-title>
<mj-title>Confirm your <%= self.domain %> account</mj-title>
<mj-attributes>
<mj-all font-family="monospace" line-height="17px" />
</mj-attributes>
</mj-head>
<mj-body>
<mj-section>
<mj-column>

<mj-text align="center" font-size="30px">
Kitsune
</mj-text>
<mj-text align="center" font-size="30px"> Kitsune </mj-text>

<mj-divider></mj-divider>

<mj-text font-size="25px">
Confirm your account
</mj-text>
<mj-text font-size="25px"> Confirm your account </mj-text>

<mj-text>
Congratulations to your new account on {{domain}}!
<p>Click the button below to unlock your account (@{{username}})!</p>
Congratulations to your new account on <%= self.domain %>!
<p>
Click the button below to unlock your account (@<%= self.username
%>)!
</p>
</mj-text>

<mj-button href="{{verify_link}}">
Confirm my account!
</mj-button>
<mj-button href="{{verify_link}}"> Confirm my account! </mj-button>

<mj-text>
You didn't register an account? Feel free to just ignore this email!
</mj-text>

<mj-text align="center" font-size="10px">
{{domain}} powered by <a style="text-decoration:none;" href="https://joinkitsune.org">Kitsune</a>
<%= self.domain %> powered by
<a style="text-decoration: none" href="https://joinkitsune.org"
>Kitsune</a
>
</mj-text>
</mj-column>
</mj-section>
</mj-body>
</mjml>
</mjml>
2 changes: 1 addition & 1 deletion crates/kitsune-language/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ isolang = { version = "2.4.0", features = [
"list_languages",
"serde",
] }
rustc-hash = "2.0.0"
rustc-hash = "2.1.0"
whatlang = "0.16.4"
whichlang = "0.1.0"

Expand Down
Loading

0 comments on commit 5de2359

Please sign in to comment.