diff --git a/crates/app/src/public/html/components.lisp b/crates/app/src/public/html/components.lisp
index 08d98a2..9dccf9a 100644
--- a/crates/app/src/public/html/components.lisp
+++ b/crates/app/src/public/html/components.lisp
@@ -58,6 +58,9 @@
(text "{% if community.is_forge -%}")
(icon (text "anvil"))
(text "{%- endif %}")
+ (text "{% if community.is_forum -%}")
+ (icon (text "square-library"))
+ (text "{%- endif %}")
(h3
("class" "name lg:long")
(text "{{ community.context.display_name }}")))
@@ -2532,7 +2535,7 @@
(icon (text "reply")))
(a
("class" "button small lowered")
- ("href" "/mail/compose?receivers={% for receiver in letter.receivers %},id%3A{{ receiver }}{% endfor %}&subject=Re%3A%20{{ letter.subject }}&replying_to={{ letter.id }}")
+ ("href" "/mail/compose?receivers={{ owner.username }}{% for receiver in letter.receivers %},id%3A{{ receiver }}{% endfor %}&subject=Re%3A%20{{ letter.subject }}&replying_to={{ letter.id }}")
("title" "Reply all")
(icon (text "reply-all")))
(text "{% if user and letter.owner == user.id -%}")
diff --git a/crates/app/src/public/html/mail/compose.lisp b/crates/app/src/public/html/mail/compose.lisp
index 1fc7c97..909cfdc 100644
--- a/crates/app/src/public/html/mail/compose.lisp
+++ b/crates/app/src/public/html/mail/compose.lisp
@@ -56,7 +56,10 @@
("placeholder" "content")
("required" "")
("name" "content")
- ("id" "content")))
+ ("id" "content")
+ (text "
+
+{{ user.settings.mail_signature }}")))
(button
(icon (text "send-horizontal"))
diff --git a/crates/app/src/public/html/profile/settings.lisp b/crates/app/src/public/html/profile/settings.lisp
index b1bbf5d..4037cd8 100644
--- a/crates/app/src/public/html/profile/settings.lisp
+++ b/crates/app/src/public/html/profile/settings.lisp
@@ -1947,6 +1947,17 @@
settings.anonymous_avatar_url,
\"input\",
],
+ [[], \"Signatures\", \"title\"],
+ [
+ [\"mail_signature\", \"Mail signature\"],
+ settings.mail_signature,
+ \"textarea\",
+ ],
+ [
+ [\"forum_signature\", \"Forum signature (coming soon)\"],
+ settings.forum_signature,
+ \"textarea\",
+ ],
[[], \"Misc\", \"title\"],
[
[\"hide_dislikes\", \"Hide post dislikes\"],
diff --git a/crates/app/src/routes/api/v1/communities/communities.rs b/crates/app/src/routes/api/v1/communities/communities.rs
index a0793b1..81266ec 100644
--- a/crates/app/src/routes/api/v1/communities/communities.rs
+++ b/crates/app/src/routes/api/v1/communities/communities.rs
@@ -55,6 +55,10 @@ pub async fn create_request(
c.is_forge = true;
c.context.enable_titles = true;
c.context.require_titles = true;
+ } else if req.forum {
+ c.is_forum = true;
+ c.context.enable_titles = true;
+ c.context.require_titles = true;
}
match data.create_community(c).await {
diff --git a/crates/app/src/routes/api/v1/mod.rs b/crates/app/src/routes/api/v1/mod.rs
index 8d1f655..4f883fb 100644
--- a/crates/app/src/routes/api/v1/mod.rs
+++ b/crates/app/src/routes/api/v1/mod.rs
@@ -749,6 +749,8 @@ pub struct CreateCommunity {
pub title: String,
#[serde(default)]
pub forge: bool,
+ #[serde(default)]
+ pub forum: bool,
}
#[derive(Deserialize)]
diff --git a/crates/core/src/database/communities.rs b/crates/core/src/database/communities.rs
index df107e9..5b6236b 100644
--- a/crates/core/src/database/communities.rs
+++ b/crates/core/src/database/communities.rs
@@ -36,6 +36,7 @@ impl DataManager {
member_count: get!(x->10(i32)) as usize,
is_forge: get!(x->11(i32)) as i8 == 1,
post_count: get!(x->12(i32)) as usize,
+ is_forum: get!(x->13(i32)) as i8 == 1,
}
}
@@ -281,7 +282,7 @@ impl DataManager {
let res = execute!(
&conn,
- "INSERT INTO communities VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)",
+ "INSERT INTO communities VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)",
params![
&(data.id as i64),
&(data.created as i64),
@@ -296,6 +297,7 @@ impl DataManager {
&1_i32,
&{ if data.is_forge { 1 } else { 0 } },
&0_i32,
+ &{ if data.is_forum { 1 } else { 0 } },
]
);
diff --git a/crates/core/src/database/drivers/sql/version_migrations.sql b/crates/core/src/database/drivers/sql/version_migrations.sql
index c101e7d..20266fb 100644
--- a/crates/core/src/database/drivers/sql/version_migrations.sql
+++ b/crates/core/src/database/drivers/sql/version_migrations.sql
@@ -12,4 +12,8 @@ ADD COLUMN IF NOT EXISTS storage_capacity TEXT DEFAULT '"Tier1"';
-- letters replying_to
ALTER TABLE letters
-ADD COLUMN IF NOT EXISTS replying_to TEXT DEFAULT 0;
+ADD COLUMN IF NOT EXISTS replying_to BIGINT DEFAULT 0;
+
+-- communities is_forum
+ALTER TABLE communities
+ADD COLUMN IF NOT EXISTS is_forum INT DEFAULT 0;
diff --git a/crates/core/src/model/auth.rs b/crates/core/src/model/auth.rs
index 001bd45..de205cb 100644
--- a/crates/core/src/model/auth.rs
+++ b/crates/core/src/model/auth.rs
@@ -344,6 +344,12 @@ pub struct UserSettings {
/// Will also revoke access to their respective pages.
#[serde(default)]
pub hide_social_follows: bool,
+ /// The signature automatically attached to new mail letters.
+ #[serde(default)]
+ pub mail_signature: String,
+ /// The signature automatically attached to new forum posts.
+ #[serde(default)]
+ pub forum_signature: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
diff --git a/crates/core/src/model/communities.rs b/crates/core/src/model/communities.rs
index 14f640f..4b9213b 100644
--- a/crates/core/src/model/communities.rs
+++ b/crates/core/src/model/communities.rs
@@ -26,6 +26,7 @@ pub struct Community {
pub member_count: usize,
pub is_forge: bool,
pub post_count: usize,
+ pub is_forum: bool,
}
impl Community {
@@ -48,6 +49,7 @@ impl Community {
member_count: 0,
is_forge: false,
post_count: 0,
+ is_forum: false,
}
}
@@ -68,6 +70,7 @@ impl Community {
member_count: 0,
is_forge: false,
post_count: 0,
+ is_forum: false,
}
}
}
@@ -515,3 +518,13 @@ impl PollVote {
}
}
}
+
+#[derive(Clone, Debug, Serialize, Deserialize)]
+pub struct ForumTopic {
+ pub id: usize,
+ pub created: usize,
+ pub owner: usize,
+ pub community: usize,
+ pub title: String,
+ pub description: String,
+}