Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Forum_data

module Forum_data : sig..end

Author(s): Vincent Balat, Boris Yakobowski


Database access with verification of permissions

val new_forum : 
  title:string ->
  descr:string ->
  ?arborescent:bool ->
  title_syntax:Html5_types.phrasing Eliom_content.Html5.F.elt list
   Wiki_types.content_type ->
  messages_wiki:Wiki_types.wiki ->
  comments_wiki:Wiki_types.wiki -> unit -> Forum_types.forum Lwt.t

create a new forum. ?arborescent is true by default. Setting it to false will prevent to comment comments. May fail with exception Ocsimore_common.Permission_denied.

val update_forum : 
  ?title:string ->
  ?descr:string ->
  ?arborescent:bool ->
  ?title_syntax:'res Wiki_types.content_type ->
  ?messages_wiki:Wiki_types.wiki ->
  ?comments_wiki:Wiki_types.wiki -> Forum_types.forum -> unit Lwt.t

Update the information of a forum. All arguments not passed are left unchanged. May fail with exception Ocsimore_common.Permission_denied.

val new_message : 
  forum:Forum_types.forum ->
  creator_id:User_sql.Types.userid ->
  ?subject:string ->
  ?parent_id:Forum_types.message ->
  text:string -> unit -> Forum_types.message Lwt.t

inserts a message in a forum. ?moderated is false by default. May fail with exception Ocsimore_common.Permission_denied.

val set_moderated : 
  message_id:Forum_types.message -> moderated:bool -> unit Lwt.t

set or unset moderated flag on a message. May fail with exception Ocsimore_common.Permission_denied.

val get_forum : 
  forum:Forum_types.forum -> unit -> Forum_types.forum_info Lwt.t

Get forum information, given its id or title. May fail with exception Ocsimore_common.Permission_denied.

val get_forums_list : unit -> Forum_types.forum_info list Lwt.t

returns the list of forums visible to the user.

val get_message : 
  message_id:Forum_types.message -> Forum_types.message_info Lwt.t

returns id, subject, author, datetime, parent id, root id, forum id, text, and moderated, deleted status of a message. May fail with exception Ocsimore_common.Permission_denied.

val get_thread : 
  message_id:Forum_types.message -> Forum_types.message_info list Lwt.t

returns a list of messages containing the message of id ~message_id and all its children, ordered according depth first traversal of the tree. Deleted messages are returned. Only readable messages comments are returned. Comments of unreadable messages are not returned. May fail with exceptions Ocsimore_common.Permission_denied or Not_found.

val get_childs : 
  message_id:Forum_types.message -> Forum_types.message_info list Lwt.t

returns a list of all the direct childs of messages ~message_id. Only readable messages comments are returned.

type raw_message
val get_message_list : 
  forum:Forum_types.forum ->
  first:int64 ->
  number:int64 -> unit -> raw_message list Lwt.t

returns the list of messages (without comments) in a forum. If the user cannot read unmoderated messages, only moderated messages and messages with special rights (must be filtered afterwards!!!) are returned.

val message_info_of_raw_message : 
  raw_message -> Forum_types.message_info Lwt.t

translate raw_message to Forum_types.forum_info, verifying special rights if needed (only for first messages). Raises Ocsimore_common.Permission_denied if special rights do not allow to read the message.