40
|
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
|