annotate src/added.js.luan @ 54:1d724f187cff

minor fix
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 03 Mar 2025 21:19:12 -0700
parents src/active.js.luan@7ea33179592a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
40
7ea33179592a email notification
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
7ea33179592a email notification
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
54
1d724f187cff minor fix
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
3 local Http = require "luan:http/Http.luan"
40
7ea33179592a email notification
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local User = require "site:/lib/User.luan"
7ea33179592a email notification
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local current_user = User.current or error()
54
1d724f187cff minor fix
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
6 local Chat = require "site:/lib/Chat.luan"
1d724f187cff minor fix
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
7 local get_chat_by_id = Chat.get_by_id or error()
40
7ea33179592a email notification
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8
7ea33179592a email notification
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9
7ea33179592a email notification
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 return function()
7ea33179592a email notification
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 local user = current_user() or error()
54
1d724f187cff minor fix
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
12 local chat = Http.request.parameters.chat or error()
1d724f187cff minor fix
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
13 chat = get_chat_by_id(chat) or error()
1d724f187cff minor fix
Franklin Schmidt <fschmidt@gmail.com>
parents: 40
diff changeset
14 chat.read(user)
40
7ea33179592a email notification
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 end