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.59.2.29 -r1.59.2.30 --- openacs-4/packages/forums/tcl/messages-procs.tcl 20 Mar 2023 15:02:15 -0000 1.59.2.29 +++ openacs-4/packages/forums/tcl/messages-procs.tcl 7 Aug 2024 09:54:43 -0000 1.59.2.30 @@ -185,9 +185,9 @@ #forums.Forum#: $message(forum_name) #forums.Thread#: $message(root_subject)\n" if {$useScreenNameP == 0} { - append text_version "#forums.Author#: $message(user_name)" + append text_version "#forums.Author#: $message(user_name)" } else { - append text_version "#forums.Author#: $message(screen_name)" + append text_version "#forums.Author#: $message(screen_name)" } append text_version " #forums.Posted#: $message(posting_date) @@ -260,9 +260,9 @@ #forums.Forum#: $message(forum_name) #forums.Thread#: $message(root_subject)\n" if {$useScreenNameP == 0} { - append text_version "#forums.Author#: $message(user_name)" + append text_version "#forums.Author#: $message(user_name)" } else { - append text_version "#forums.Author#: $message(screen_name)" + append text_version "#forums.Author#: $message(screen_name)" } append text_version " #forums.Posted#: $message(posting_date) @@ -311,7 +311,7 @@ db_dml update_message_title {} if {!$no_callback_p} { - callback forum::message_edit -package_id [ad_conn package_id] -message_id $message_id + callback forum::message_edit -package_id [ad_conn package_id] -message_id $message_id } } @@ -337,7 +337,10 @@ # make sure array is empty array unset row - set attachments_sql [expr {[ns_conn isconnected] && [forum::attachments_enabled_p] ? { + set forum_id [::xo::dc list -prepare integer get_forum_id_from_message_id { + select forum_id from forums_messages where message_id = :message_id + }] + set attachments_sql [expr {[ns_conn isconnected] && [forum::attachments_enabled_p -forum_id $forum_id] ? { (select count(*) from attachments where object_id = m.message_id) as n_attachments, } : ""}] @@ -425,9 +428,9 @@ Delete a message and obviously all of its descendents. } { db_transaction { - if {!$no_callback_p} { - callback forum::message_delete -package_id [ad_conn package_id] -message_id $message_id - } + if {!$no_callback_p} { + callback forum::message_delete -package_id [ad_conn package_id] -message_id $message_id + } forum::message::get -message_id $message_id -array msg set forum_id $msg(forum_id) @@ -515,7 +518,11 @@ @see attachments::get_attachments } { # If attachments aren't enabled, then we stop - if {![forum::attachments_enabled_p]} { + set forum_id [::xo::dc list -prepare integer get_forum_id_from_message_id { + select forum_id from forums_messages where message_id = :message_id + }] + + if {![forum::attachments_enabled_p -forum_id $forum_id]} { return [list] }