clean code, fix html escape in discuss
This commit is contained in:
parent
f56724edeb
commit
95deed44bb
1 changed files with 1 additions and 4 deletions
|
|
@ -44,7 +44,6 @@ let () =
|
||||||
|
|
||||||
(** let's find who the user is talking to so we can know if they're dangerous *)
|
(** let's find who the user is talking to so we can know if they're dangerous *)
|
||||||
let find_comrades user_id =
|
let find_comrades user_id =
|
||||||
let open Syntax in
|
|
||||||
let^ comrades = Db.collect_list Q.find_comrades (user_id, user_id) in
|
let^ comrades = Db.collect_list Q.find_comrades (user_id, user_id) in
|
||||||
let comrades =
|
let comrades =
|
||||||
List.map (fun (l, r) -> if l = user_id then r else l) comrades
|
List.map (fun (l, r) -> if l = user_id then r else l) comrades
|
||||||
|
|
@ -53,7 +52,6 @@ let find_comrades user_id =
|
||||||
|
|
||||||
(** find all messages between two товарищи *)
|
(** find all messages between two товарищи *)
|
||||||
let find_messages k1 k2 =
|
let find_messages k1 k2 =
|
||||||
let open Syntax in
|
|
||||||
let^ comrades = Db.collect_list Q.find_messages ((k1, k2), (k2, k1)) in
|
let^ comrades = Db.collect_list Q.find_messages ((k1, k2), (k2, k1)) in
|
||||||
Ok comrades
|
Ok comrades
|
||||||
|
|
||||||
|
|
@ -90,7 +88,7 @@ let pp_discussion (request, user_id, comrade_id) =
|
||||||
let pp_one_msg fmt (from_id, msg) =
|
let pp_one_msg fmt (from_id, msg) =
|
||||||
Format.fprintf fmt "<li>%s | %s</li>"
|
Format.fprintf fmt "<li>%s | %s</li>"
|
||||||
(if from_id = user_id then user_nick else comrade_nick)
|
(if from_id = user_id then user_nick else comrade_nick)
|
||||||
msg
|
(Dream.html_escape msg)
|
||||||
in
|
in
|
||||||
let pp_all_msg fmt msg =
|
let pp_all_msg fmt msg =
|
||||||
Format.fprintf fmt "<ul>%a</ul>"
|
Format.fprintf fmt "<ul>%a</ul>"
|
||||||
|
|
@ -116,7 +114,6 @@ let renderone request =
|
||||||
pp_discussion (request, user_id, comrade_id) )
|
pp_discussion (request, user_id, comrade_id) )
|
||||||
|
|
||||||
let insert_msg from_id to_id msg =
|
let insert_msg from_id to_id msg =
|
||||||
let open Syntax in
|
|
||||||
let^ () = Db.exec Q.insert_msg (from_id, to_id, msg) in
|
let^ () = Db.exec Q.insert_msg (from_id, to_id, msg) in
|
||||||
Ok ()
|
Ok ()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue