Author: Manos Pitsidianakis [manos@pitsidianak.is]
Hash: 99e424f76e1f920558c775edd173858ad20660ec
Timestamp: Sun, 29 Oct 2023 10:38:38 +0000 (10 months ago)

+4 -3 +/-1 browse
core/posts: fix approval_needed in subscription request
core/posts: fix approval_needed in subscription request

Checking if approval is needed for a subscription request was done from
the post policy instead of the subscription policy (ugh...)

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
1diff --git a/core/src/posts.rs b/core/src/posts.rs
2index 777d09f..995929d 100644
3--- a/core/src/posts.rs
4+++ b/core/src/posts.rs
5 @@ -305,7 +305,6 @@ impl Connection {
6 env: &Envelope,
7 raw: &[u8],
8 ) -> Result<()> {
9- let post_policy = self.list_post_policy(list.pk)?;
10 match request {
11 ListRequest::Help => {
12 trace!(
13 @@ -314,6 +313,7 @@ impl Connection {
14 list
15 );
16 let subscription_policy = self.list_subscription_policy(list.pk)?;
17+ let post_policy = self.list_post_policy(list.pk)?;
18 let subject = format!("Help for {}", list.name);
19 let details = list
20 .generate_help_email(post_policy.as_deref(), subscription_policy.as_deref());
21 @@ -341,9 +341,10 @@ impl Connection {
22 env.from(),
23 list
24 );
25- let approval_needed = post_policy
26+ let subscription_policy = self.list_subscription_policy(list.pk)?;
27+ let approval_needed = subscription_policy
28 .as_ref()
29- .map(|p| p.approval_needed)
30+ .map(|p| !p.open)
31 .unwrap_or(false);
32 for f in env.from() {
33 let email_from = f.get_email();