Currently, sending emails is disabled by default and there is no way to
change it. Add a relevant setting to profile page.

Signed-off-by: Franciszek Stachura <[email protected]>
---
 pkg/web/profile.go    |  2 ++
 pkg/web/profile.templ | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/pkg/web/profile.go b/pkg/web/profile.go
index bba977d..78b017b 100644
--- a/pkg/web/profile.go
+++ b/pkg/web/profile.go
@@ -124,11 +124,13 @@ func (h *webHandler) ProfileUpdate(w http.ResponseWriter, 
r *http.Request) {
                itemsPerPage = 100
        }
        showIds := r.FormValue("show_ids") == "on"
+       sendEmail := r.FormValue("send_email") == "on"
 
        _, _ = q.Update((*db.User)(nil)).
                Where("id = ?", user.ID).
                Set("items_per_page = ?", itemsPerPage).
                Set("show_ids = ?", showIds).
+               Set("send_email = ?", sendEmail).
                Exec(ctx)
 
        http.Redirect(w, r, "/user", http.StatusFound)
diff --git a/pkg/web/profile.templ b/pkg/web/profile.templ
index 333b945..87d7927 100644
--- a/pkg/web/profile.templ
+++ b/pkg/web/profile.templ
@@ -121,6 +121,16 @@ templ profilePage(d profileData) {
                                                                        }
                                                                </td>
                                                        </tr>
+                                                       <tr>
+                                                               <th>Send 
emails</th>
+                                                               <td>
+                                                                       if 
d.User.SendEmail {
+                                                                               
<input type="checkbox" name="send_email" checked/>
+                                                                       } else {
+                                                                               
<input type="checkbox" name="send_email"/>
+                                                                       }
+                                                               </td>
+                                                       </tr>
                                                        <tr>
                                                                <td 
colspan="2"><button type="submit">Apply</button></td>
                                                        </tr>
-- 
2.56.0

_______________________________________________
Patchwork mailing list
[email protected]
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to