Mercurial Hosting > chat
comparison src/save_notify.js.luan @ 40:7ea33179592a
email notification
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 27 Feb 2025 16:44:20 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
39:471b13e6ce2c | 40:7ea33179592a |
---|---|
1 local Luan = require "luan:Luan.luan" | |
2 local error = Luan.error | |
3 local Http = require "luan:http/Http.luan" | |
4 local Db = require "site:/lib/Db.luan" | |
5 local run_in_transaction = Db.run_in_transaction or error() | |
6 local User = require "site:/lib/User.luan" | |
7 local current_user = User.current or error() | |
8 | |
9 | |
10 return function() | |
11 local email = Http.request.parameters.email or error() | |
12 local multi = Http.request.parameters.multi or error() | |
13 run_in_transaction( function() | |
14 local user = current_user() or error() | |
15 user.notify_email = email ~= "" and email or nil | |
16 user.multi_notify = multi == "true" | |
17 user.save() | |
18 end ) | |
19 end |