[dw-free] If a user has opted out of PMs, remove "send message" from the hover menu
[commit: http://hg.dwscoalition.org/dw-free/rev/87b4265a6eb2]
http://bugs.dwscoalition.org/show_bug.cgi?id=2842
Don't include Send Message link in contextual popup if a message can't be
sent.
Patch by
yvi.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2842
Don't include Send Message link in contextual popup if a message can't be
sent.
Patch by
Files modified:
- cgi-bin/LJ/User.pm
- htdocs/js/contextualhover.js
- htdocs/tools/endpoints/ctxpopup.bml
--------------------------------------------------------------------------------
diff -r df0306930552 -r 87b4265a6eb2 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm Tue Aug 17 18:00:54 2010 +0800
+++ b/cgi-bin/LJ/User.pm Tue Aug 17 12:22:29 2010 -0500
@@ -621,8 +621,6 @@ sub info_for_js {
is_syndicated => $u->is_syndicated,
is_identity => $u->is_identity,
);
- # Without url_message "Send Message" link should not display
- $ret{url_message} = $u->message_url unless ($u->opt_usermsg eq 'N');
LJ::Hooks::run_hook("extra_info_for_js", $u, \%ret);
diff -r df0306930552 -r 87b4265a6eb2 htdocs/js/contextualhover.js
--- a/htdocs/js/contextualhover.js Tue Aug 17 18:00:54 2010 +0800
+++ b/htdocs/js/contextualhover.js Tue Aug 17 12:22:29 2010 -0500
@@ -357,7 +357,7 @@ ContextualPopup.renderPopup = function (
// send message
var message;
- if (data.is_logged_in && (data.is_person || data.is_identity) && data.url_message) {
+ if ( data.is_logged_in && ( data.is_person || data.is_identity ) && data.can_message ) {
message = document.createElement("span");
var sendmessage = document.createElement("a");
diff -r df0306930552 -r 87b4265a6eb2 htdocs/tools/endpoints/ctxpopup.bml
--- a/htdocs/tools/endpoints/ctxpopup.bml Tue Aug 17 18:00:54 2010 +0800
+++ b/htdocs/tools/endpoints/ctxpopup.bml Tue Aug 17 12:22:29 2010 -0500
@@ -109,6 +109,8 @@ _c?>
$ret{is_requester} = $remote->equals( $u );
$ret{other_is_identity} = $u->is_identity;
$ret{self_is_identity} = $remote->is_identity;
+ $ret{can_message} = $u->can_receive_message( $remote );
+ $ret{url_message} = $u->message_url;
}
$ret{is_logged_in} = $remote ? 1 : 0;
--------------------------------------------------------------------------------
