Index: openacs-4/packages/forums/forums.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/forums.info,v diff -u -r1.25.2.7 -r1.25.2.8 --- openacs-4/packages/forums/forums.info 9 Dec 2004 20:11:17 -0000 1.25.2.7 +++ openacs-4/packages/forums/forums.info 23 Dec 2004 02:12:53 -0000 1.25.2.8 @@ -7,14 +7,14 @@ f f - + OpenACS Online discussion forums. 2003-11-10 OpenACS This online discussion board software is the successor of the original bboard package. The biggest improvement is a scalable datamodel. Forums supports threaded and flat view, moderation, a stand alone search function as well as integration with the OpenACS search package and integration with the notifications package for email alerts. It also supports reply via email. - + Index: openacs-4/packages/forums/lib/forums/forums-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/Attic/forums-chunk-oracle.xql,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/forums/lib/forums/forums-chunk-oracle.xql 17 Dec 2003 15:45:29 -0000 1.1 +++ openacs-4/packages/forums/lib/forums/forums-chunk-oracle.xql 23 Dec 2004 02:12:53 -0000 1.1.2.1 @@ -6,10 +6,7 @@ select forums_forums_enabled.*, - (select count(*) - from forums_messages_approved - where forums_messages_approved.forum_id = forums_forums_enabled.forum_id - and parent_id is null) as n_threads, + approved_thread_count as n_threads, to_char(last_post, 'YYYY-MM-DD HH24:MI:SS') as last_post_ansi, case when last_post > (sysdate - 1) then 't' else 'f' end as new_p from forums_forums_enabled Index: openacs-4/packages/forums/lib/forums/forums-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/Attic/forums-chunk-postgresql.xql,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/forums/lib/forums/forums-chunk-postgresql.xql 17 Dec 2003 15:45:29 -0000 1.1 +++ openacs-4/packages/forums/lib/forums/forums-chunk-postgresql.xql 23 Dec 2004 02:12:53 -0000 1.1.2.1 @@ -6,10 +6,7 @@ select forums_forums_enabled.*, - (select count(*) - from forums_messages_approved - where forums_messages_approved.forum_id = forums_forums_enabled.forum_id - and parent_id is null) as n_threads, + approved_thread_count as n_threads, to_char(last_post, 'YYYY-MM-DD HH24:MI:SS') as last_post_ansi, case when last_post > (now() - interval '1 day') then 't' else 'f' end as new_p from forums_forums_enabled Index: openacs-4/packages/forums/lib/message/threads-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/Attic/threads-chunk-oracle.xql,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/forums/lib/message/threads-chunk-oracle.xql 4 Dec 2004 17:54:03 -0000 1.1.2.2 +++ openacs-4/packages/forums/lib/message/threads-chunk-oracle.xql 23 Dec 2004 02:12:54 -0000 1.1.2.3 @@ -8,10 +8,7 @@ fm.subject, person.name(fm.user_id) as user_name, to_char(fm.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, - (select count(*) - from $replies_view fm1 - where fm1.forum_id = :forum_id - and fm1.tree_sortkey between tree.left(fm.tree_sortkey) and tree.right(fm.tree_sortkey)) as n_messages, + $replies as n_messages, to_char(fm.last_child_post, 'YYYY-MM-DD HH24:MI:SS') as last_child_post_ansi from forums_messages_approved fm where fm.forum_id = :forum_id @@ -28,10 +25,7 @@ person.name(fm.user_id) as user_name, to_char(fm.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, fm.state, - (select count(*) - from $replies_view fm1 - where fm1.forum_id = :forum_id - and fm1.tree_sortkey between tree.left(fm.tree_sortkey) and tree.right(fm.tree_sortkey)) as n_messages, + $replies as n_messages, to_char(fm.last_child_post, 'YYYY-MM-DD HH24:MI:SS') as last_child_post_ansi, case when fm.last_child_post > (sysdate - 1) then 't' else 'f' end as new_p from forums_messages_approved fm Index: openacs-4/packages/forums/lib/message/threads-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/Attic/threads-chunk-postgresql.xql,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/forums/lib/message/threads-chunk-postgresql.xql 4 Dec 2004 17:54:03 -0000 1.1.2.2 +++ openacs-4/packages/forums/lib/message/threads-chunk-postgresql.xql 23 Dec 2004 02:12:54 -0000 1.1.2.3 @@ -7,10 +7,7 @@ select fm.message_id, fm.subject, person__name(fm.user_id) as user_name, - (select count(*) - from $replies_view fm1 - where fm1.forum_id = :forum_id - and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages, + $replies as n_messages, to_char(fm.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi from forums_messages_approved fm where fm.forum_id = :forum_id @@ -27,10 +24,7 @@ person__name(fm.user_id) as user_name, to_char(fm.posting_date, 'YYYY-MM-DD HH24:MI:SS') as posting_date_ansi, fm.state, - (select count(*) - from $replies_view fm1 - where fm1.forum_id = :forum_id - and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages, + $replies as n_messages, to_char(fm.last_child_post, 'YYYY-MM-DD HH24:MI:SS') as last_child_post_ansi, case when fm.last_child_post > (now() - interval '1 day') then 't' else 'f' end as new_p from forums_messages_approved fm Index: openacs-4/packages/forums/lib/message/threads-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/threads-chunk.tcl,v diff -u -r1.2.2.6 -r1.2.2.7 --- openacs-4/packages/forums/lib/message/threads-chunk.tcl 4 Dec 2004 20:44:12 -0000 1.2.2.6 +++ openacs-4/packages/forums/lib/message/threads-chunk.tcl 23 Dec 2004 02:12:54 -0000 1.2.2.7 @@ -11,11 +11,10 @@ # Get forum data forum::get -forum_id $forum_id -array forum -set query messages_select if { $moderate_p } { - set replies_view forums_messages + set replies reply_count } else { - set replies_view forums_messages_approved + set replies approved_reply_count } set actions [list] Index: openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql,v diff -u -r1.6 -r1.6.4.1 --- openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql 17 May 2003 10:42:08 -0000 1.6 +++ openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql 23 Dec 2004 02:12:54 -0000 1.6.4.1 @@ -70,6 +70,9 @@ package_id integer constraint forums_package_id_nn not null, + thread_count integer default 0, + approved_thread_count integer default 0, + forums_forums integer default 0, last_post timestamptz ); Index: openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql,v diff -u -r1.9.4.4 -r1.9.4.5 --- openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql 6 Jul 2004 15:54:52 -0000 1.9.4.4 +++ openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql 23 Dec 2004 02:12:54 -0000 1.9.4.5 @@ -46,6 +46,8 @@ tree_sortkey varbit, max_child_sortkey varbit, last_child_post timestamptz, + reply_count integer default 0, + approved_reply_count integer default 0, constraint forums_mess_sk_forum_un unique (tree_sortkey, forum_id) ); Index: openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql,v diff -u -r1.13.2.1 -r1.13.2.2 --- openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql 22 Jun 2004 16:53:43 -0000 1.13.2.1 +++ openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql 23 Dec 2004 02:12:54 -0000 1.13.2.2 @@ -12,9 +12,12 @@ -- chunks lifted from Gilbert. Thanks Orchard Labs! -- -select define_function_args ('forums_message__new', 'message_id,object_type;forums_message,forum_id,subject,content,format,user_id,posting_date,state,parent_id,creation_date,creation_user,creation_ip,context_id'); +select define_function_args ('forums_message__new', 'message_id,object_type;forums_message,forum_id,subject,content,format,user_id,state,parent_id,creation_date,creation_user,creation_ip,context_id'); -create function forums_message__new (integer,varchar,integer,varchar,text,char,integer,timestamptz,varchar,integer,timestamptz,integer,varchar,integer) +-- Get rid of the old version so we'll throw an error if the admin forgets to reboot +-- OpenACS after the upgrade (package_instantiate_object caches param lists) + +create or replace function forums_message__new (integer,varchar,integer,varchar,text,char,integer,varchar,integer,timestamptz,integer,varchar,integer) returns integer as ' declare p_message_id alias for $1; @@ -24,17 +27,15 @@ p_content alias for $5; p_format alias for $6; p_user_id alias for $7; - p_posting_date alias for $8; - p_state alias for $9; - p_parent_id alias for $10; - p_creation_date alias for $11; - p_creation_user alias for $12; - p_creation_ip alias for $13; - p_context_id alias for $14; + p_state alias for $8; + p_parent_id alias for $9; + p_creation_date alias for $10; + p_creation_user alias for $11; + p_creation_ip alias for $12; + p_context_id alias for $13; v_message_id integer; v_forum_policy forums_forums.posting_policy%TYPE; v_state forums_messages.state%TYPE; - v_posting_date forums_messages.posting_date%TYPE; begin v_message_id := acs_object__new( p_message_id, @@ -59,29 +60,45 @@ v_state := p_state; end if; - if p_posting_date is null then - v_posting_date = now(); - else - v_posting_date = p_posting_date; - end if; - insert into forums_messages - (message_id, forum_id, subject, content, format, user_id, posting_date, parent_id, state) + (message_id, forum_id, subject, content, format, user_id, parent_id, state, last_child_post) values - (v_message_id, p_forum_id, p_subject, p_content, p_format, p_user_id, v_posting_date, p_parent_id, v_state); + (v_message_id, p_forum_id, p_subject, p_content, p_format, p_user_id, p_parent_id, + v_state, current_timestamp); update forums_forums - set last_post = v_posting_date + set last_post = current_timestamp where forum_id = p_forum_id; - update forums_messages - set last_child_post = v_posting_date - where message_id = forums_message__root_message_id(v_message_id); + if p_parent_id is null then + if v_state = ''approved'' then + update forums_forums + set thread_count = thread_count + 1, + approved_thread_count = approved_thread_count + 1 + where forum_id=p_forum_id; + else + update forums_forums + set thread_count = thread_count + 1 + where forum_id=p_forum_id; + end if; + else + if v_state = ''approved'' then + update forums_messages + set approved_reply_count = approved_reply_count + 1, + reply_count = reply_count + 1, + last_child_post = current_timestamp + where message_id = forums_message__root_message_id(v_message_id); + else + update forums_messages + set reply_count = reply_count + 1, + last_child_post = current_timestamp + where message_id = forums_message__root_message_id(v_message_id); + end if; + end if; return v_message_id; -end; -' language 'plpgsql'; +end;' language 'plpgsql'; select define_function_args ('forums_message__root_message_id', 'message_id'); @@ -162,21 +179,94 @@ end; ' language 'plpgsql'; +select define_function_args ('forums_message__set_state', 'message_id,state'); + +create or replace function forums_message__set_state(integer,varchar) returns integer as ' +declare + p_message_id alias for $1; + p_state alias for $2; + v_cur record; +begin + + select into v_cur * + from forums_messages + where message_id = p_message_id; + + if v_cur.parent_id is null then + if p_state = ''approved'' and v_cur.state <> ''approved'' then + update forums_forums + set approved_thread_count = approved_thread_count + 1 + where forum_id=v_cur.forum_id; + elsif p_state <> ''approved'' and v_cur.state = ''approved'' then + update forums_forums + set approved_thread_count = approved_thread_count - 1 + where forum_id=v_cur.forum_id; + end if; + else + if p_state = ''approved'' and v_cur.state <> ''approved'' then + update forums_messages + set approved_reply_count = approved_reply_count + 1 + where message_id = forums_message__root_message_id(v_cur.message_id); + elsif p_state <> ''approved'' and v_cur.state = ''approved'' then + update forums_messages + set approved_reply_count = approved_reply_count - 1 + where message_id = forums_message__root_message_id(v_cur.message_id); + end if; + end if; + + update forums_messages + set state = p_state + where message_id = p_message_id; + + return 0; + +end;' language 'plpgsql'; + select define_function_args ('forums_message__delete', 'message_id'); -create function forums_message__delete (integer) +create or replace function forums_message__delete (integer) returns integer as ' declare - p_message_id alias for $1; + p_message_id alias for $1; + v_cur record; begin - perform acs_object__delete(p_message_id); - return 0; -end; -' language 'plpgsql'; + -- Maintain the forum thread counts + + select into v_cur * + from forums_messages + where message_id = p_message_id; + + if v_cur.parent_id is null then + if v_cur.state = ''approved'' then + update forums_forums + set thread_count = thread_count - 1, + approved_thread_count = approved_thread_count - 1 + where forum_id=v_cur.forum_id; + else + update forums_forums + set thread_count = thread_count - 1 + where forum_id=v_cur.forum_id; + end if; + elsif v_cur.state = ''approved'' then + update forums_messages + set approved_reply_count = approved_reply_count - 1, + reply_count = reply_count - 1 + where message_id = forums_message__root_message_id(v_cur.message_id); + else + update forums_messages + set reply_count = reply_count - 1 + where message_id = forums_message__root_message_id(v_cur.message_id); + end if; + + perform acs_object__delete(p_message_id); + return 0; + +end;' language 'plpgsql'; + select define_function_args ('forums_message__delete_thread', 'message_id'); -create function forums_message__delete_thread (integer) +create or replace function forums_message__delete_thread (integer) returns integer as ' declare p_message_id alias for $1; @@ -204,16 +294,17 @@ and tree_sortkey between tree_left(v_sortkey) and tree_right(v_sortkey) order by tree_sortkey desc loop - perform forums_message__delete(v_message.message_id); + -- Avoid the count bookkeeping down in forums_message__delete + perform acs_object__delete(v_message.message_id); end loop; -- delete the message itself perform forums_message__delete(p_message_id); return 0; -end; -' language 'plpgsql'; +end;' language 'plpgsql'; + select define_function_args('forums_message__name','message_id'); create function forums_message__name (integer) Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.0.6-1.0.7d.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/forums/tcl/forums-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-procs.tcl,v diff -u -r1.11.4.1 -r1.11.4.2 --- openacs-4/packages/forums/tcl/forums-procs.tcl 17 Jun 2004 19:57:45 -0000 1.11.4.1 +++ openacs-4/packages/forums/tcl/forums-procs.tcl 23 Dec 2004 02:12:54 -0000 1.11.4.2 @@ -20,12 +20,14 @@ } { create a new forum } { - # Prepare the variables for instantiation - set extra_vars [ns_set create] - oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {forum_id name charter presentation_type posting_policy package_id} - - # Instantiate the forum - return [package_instantiate_object -extra_vars $extra_vars forums_forum] + set var_list [list \ + [list forum_id $forum_id] \ + [list name $name] \ + [list charter $charter] \ + [list presentation_type $presentation_type] \ + [list posting_policy $posting_policy] \ + [list package_id $package_id]] + return [package_instantiate_object -var_list $var_list forums_forum] } ad_proc -public forum::edit { Index: openacs-4/packages/forums/tcl/messages-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/Attic/messages-procs-oracle.xql,v diff -u -r1.7 -r1.7.4.1 --- openacs-4/packages/forums/tcl/messages-procs-oracle.xql 18 Nov 2002 18:01:07 -0000 1.7 +++ openacs-4/packages/forums/tcl/messages-procs-oracle.xql 23 Dec 2004 02:12:54 -0000 1.7.4.1 @@ -47,14 +47,6 @@ - - - declare begin - forums_message.delete_thread(:message_id); - end; - - - declare begin Index: openacs-4/packages/forums/tcl/messages-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/Attic/messages-procs-postgresql.xql,v diff -u -r1.7 -r1.7.4.1 --- openacs-4/packages/forums/tcl/messages-procs-postgresql.xql 14 Jan 2003 13:29:28 -0000 1.7 +++ openacs-4/packages/forums/tcl/messages-procs-postgresql.xql 23 Dec 2004 02:12:54 -0000 1.7.4.1 @@ -46,12 +46,6 @@ - - - select forums_message__delete_thread(:message_id); - - - select forums_message__thread_close(:message_id); Index: openacs-4/packages/forums/tcl/messages-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/messages-procs.tcl,v diff -u -r1.24.2.4 -r1.24.2.5 --- openacs-4/packages/forums/tcl/messages-procs.tcl 6 Jul 2004 15:54:52 -0000 1.24.2.4 +++ openacs-4/packages/forums/tcl/messages-procs.tcl 23 Dec 2004 02:12:54 -0000 1.24.2.5 @@ -18,7 +18,6 @@ {-content:required} {-format "text/plain"} {-user_id ""} - {-posting_date ""} } { create a new message } { @@ -29,13 +28,20 @@ } set original_message_id $message_id - # Prepare the variables for instantiation - set extra_vars [ns_set create] - oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {forum_id message_id parent_id subject content format user_id} db_transaction { - set message_id [package_instantiate_object -extra_vars $extra_vars forums_message] + set var_list [list \ + [list forum_id $forum_id] \ + [list message_id $message_id] \ + [list parent_id $parent_id] \ + [list subject $subject] \ + [list content $content] \ + [list format $format] \ + [list user_id $user_id]] + + set message_id [package_instantiate_object -var_list $var_list forums_message] + get -message_id $message_id -array message if {[info exists message(state)] && [string equal $message(state) approved]} { do_notifications -message_id $message_id @@ -58,7 +64,7 @@ ad_return_error \ "OACS Internal Error" \ "Error in forums::message::new - $errmsg" - } + } } } @@ -191,8 +197,10 @@ Set the new state for a message Usually used for approval } { - # simple DB update - db_dml update_message_state {} + set var_list [list \ + [list message_id $message_id] \ + [list state $state]] + package_exec_plsql -var_list $var_list forums_message set_state } ad_proc -public forum::message::reject { @@ -224,7 +232,8 @@ notification::request::delete_all -object_id $message_id # Remove the message - db_exec_plsql delete_message {} + set var_list [list [list message_id $message_id]] + package_exec_plsql -var_list $var_list forums_message delete_thread } } Index: openacs-4/packages/forums/tcl/messages-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/messages-procs.xql,v diff -u -r1.3.8.1 -r1.3.8.2 --- openacs-4/packages/forums/tcl/messages-procs.xql 22 Jun 2004 16:53:43 -0000 1.3.8.1 +++ openacs-4/packages/forums/tcl/messages-procs.xql 23 Dec 2004 02:12:54 -0000 1.3.8.2 @@ -19,14 +19,6 @@ - - - update forums_messages - set state = :state - where message_id = :message_id - - - select count(message_id) Index: openacs-4/packages/forums/tcl/test/forums-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/test/forums-procs.tcl,v diff -u -r1.1 -r1.1.4.1 --- openacs-4/packages/forums/tcl/test/forums-procs.tcl 15 Nov 2003 15:30:06 -0000 1.1 +++ openacs-4/packages/forums/tcl/test/forums-procs.tcl 23 Dec 2004 02:12:54 -0000 1.1.4.1 @@ -6,7 +6,7 @@ @cvs-id $Id$ } -aa_register_case forum_new { +aa_register_case -cats {api smoke} forum_new { Test the forum::new proc. } { @@ -27,7 +27,7 @@ } } -aa_register_case forum_message_new { +aa_register_case -cats {api smoke} forum_message_new { Test the forum::message::new proc. } { @@ -53,3 +53,94 @@ aa_equals "message was created succesfully" $success_p 1 } } + +aa_register_case -cats {db smoke} forum_count_test { + Test the thread count and reply count tracking code. +} { + + aa_run_with_teardown \ + -rollback \ + -test_code { + + # Create open forum + set forum_id [forum::new \ + -name foo \ + -package_id [ad_conn package_id]] + + forum::get -forum_id $forum_id -array forum + aa_equals "New forum has zero approved threads" $forum(approved_thread_count) 0 + aa_equals "New forum has zero threads" $forum(thread_count) 0 + + # Create message + set message_id [forum::message::new \ + -forum_id $forum_id \ + -subject foo \ + -content foo] + + forum::get -forum_id $forum_id -array forum + aa_equals "After post forum has one approved thread" $forum(approved_thread_count) 1 + aa_equals "After post forum has one threads" $forum(thread_count) 1 + + forum::message::get -message_id $message_id -array message + aa_equals "New post has zero approved replies" $message(approved_reply_count) 0 + aa_equals "New post has zero threads" $message(reply_count) 0 + + set reply_id [forum::message::new \ + -forum_id $forum_id \ + -parent_id $message_id \ + -subject foo \ + -content foo] + + forum::get -forum_id $forum_id -array forum + aa_equals "After reply forum has one approved thread" $forum(approved_thread_count) 1 + aa_equals "After reply forum has one thread" $forum(thread_count) 1 + + forum::message::get -message_id $message_id -array message + aa_equals "After reply post has one approved replies" $message(approved_reply_count) 1 + aa_equals "After reply post has one reply" $message(reply_count) 1 + + # Create moderated forum + set forum_id [forum::new \ + -name bar \ + -posting_policy moderated \ + -package_id [ad_conn package_id]] + + # Create message + set message_id [forum::message::new \ + -forum_id $forum_id \ + -subject "foo" \ + -content "foo"] + + forum::get -forum_id $forum_id -array forum + aa_equals "After post moderated forum has zero approved threads" $forum(approved_thread_count) 0 + aa_equals "After post moderated forum has one thread" $forum(thread_count) 1 + + set reply_id [forum::message::new \ + -forum_id $forum_id \ + -parent_id $message_id \ + -subject "foo" \ + -content "foo"] + + forum::message::get -message_id $message_id -array message + aa_equals "After reply moderated post has zero approved replies" $message(approved_reply_count) 0 + aa_equals "After reply moderated post has one reply" $message(reply_count) 1 + + forum::message::set_state -message_id $message_id -state approved + + forum::get -forum_id $forum_id -array forum + aa_equals "After approval moderated forum has one approved thread" $forum(approved_thread_count) 1 + aa_equals "After approval moderated forum has one thread" $forum(thread_count) 1 + + forum::message::set_state -message_id $reply_id -state approved + + forum::message::get -message_id $message_id -array message + aa_equals "After reply approval post has one approved reply" $message(approved_reply_count) 1 + aa_equals "After reply approval post has one reply" $message(reply_count) 1 + + forum::message::delete -message_id $message_id + + forum::get -forum_id $forum_id -array forum + aa_equals "After deletion moderated forum has zero approved threads" $forum(approved_thread_count) 0 + aa_equals "After deletion moderated forum has zero threads" $forum(thread_count) 0 + } +}