Index: openacs-4/packages/notifications/tcl/notification-display-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-display-procs.tcl,v diff -u -r1.21 -r1.22 --- openacs-4/packages/notifications/tcl/notification-display-procs.tcl 7 Aug 2017 23:48:13 -0000 1.21 +++ openacs-4/packages/notifications/tcl/notification-display-procs.tcl 3 Sep 2024 15:37:39 -0000 1.22 @@ -27,7 +27,7 @@ if { [apm_package_url_from_key [notification::package_key]] eq "" } { return {} } - + if {$user_id eq ""} { set user_id [ad_conn user_id] } @@ -37,7 +37,7 @@ # Check if subscribed set request_id [notification::request::get_request_id -type_id $type_id -object_id $object_id -user_id $user_id] - + if {$request_id ne ""} { set icon /resources/acs-subsite/email_delete.gif set icon_alt [_ acs-subsite.icon_of_envelope] @@ -114,20 +114,19 @@ {-object_id:required} {-return_url {}} {-pretty_name} + -user_id } { - Get both subscribe_url and unsubscribe_url as . - At most one of them will be set. + Get both subscribe_url and unsubscribe_url as a list. At most one + of them will be set. - Example:
-    foreach { subscribe_url unsubscribe_url } \
-        [notification::display::get_urls \
+    Example:
+    
+    lassign [notification::display::get_urls \
              -type "my_notif_type" \
              -object_id $object_id \
-             -pretty_name $title] {}
+ -pretty_name $title] subscribe_url unsubscribe_url +
- The above foreach trick will cause subscribe_url and unsubscribe_url - to be set correctly. Don't forget the end pair of curly braces. - @return a Tcl list with two elements (subscribe_url, unsubscribe_url) } { set root_path [apm_package_url_from_key [notification::package_key]] @@ -141,7 +140,11 @@ } # Check if subscribed - set request_id [notification::request::get_request_id -type_id $type_id -object_id $object_id -user_id [ad_conn untrusted_user_id]] + if {![info exists user_id]} { + set user_id [ad_conn untrusted_user_id] + } + set request_id [notification::request::get_request_id \ + -type_id $type_id -object_id $object_id -user_id $user_id] if { $request_id eq "" } {