Don't show join option for closed communities.
Patch by yvi.
diffs (113 lines):
diff -r 20a8b4b428f4 -r f1c730aaded6 cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl Sat Jun 20 15:15:07 2009 +0000
+++ b/cgi-bin/weblib.pl Sun Jun 21 03:25:39 2009 +0000
@@ -2544,7 +2544,8 @@ sub control_strip
$links{'remove_friend'} = "<a
href='$LJ::SITEROOT/manage/circle/add.bml?user=$journal->{user}'>$BML::ML{'web.controlstrip.links.removefeed'}</a>";
}
if ($journal->is_community) {
- $links{'join_community'} = "<a
href='$LJ::SITEROOT/community/join.bml?comm=$journal->{user}'>$BML::ML{'web.controlstrip.links.joincomm'}</a>";
+ $links{'join_community'} = "<a
href='$LJ::SITEROOT/community/join.bml?comm=$journal->{user}'>$BML::ML{'web.controlstrip.links.joincomm'}</a>"
+ unless $journal->is_closed_membership;
$links{'leave_community'} = "<a
href='$LJ::SITEROOT/community/leave.bml?comm=$journal->{user}'>$BML::ML{'web.controlstrip.links.leavecomm'}</a>";
$links{'watch_community'} = "<a
href='$LJ::SITEROOT/manage/circle/add.bml?user=$journal->{user}&action=subscribe'>$BML::ML{'web.controlstrip.links.watchcomm'}</a>";
$links{'unwatch_community'} = "<a
href='$LJ::SITEROOT/community/leave.bml?comm=$journal->{user}'>$BML::ML{'web.controlstrip.links.removecomm'}</a>";
@@ -2740,6 +2741,7 @@ sub control_strip
my $watching = $remote->watches( $journal );
my $memberof = $remote->member_of( $journal );
my $haspostingaccess = LJ::check_rel($journal, $remote, 'P');
+ my $isclosedcommunity = $journal->is_closed_membership;
if (LJ::can_manage_other($remote, $journal)) {
$ret .= "$statustext{maintainer}<br />";
if ($haspostingaccess) {
@@ -2758,7 +2760,13 @@ sub control_strip
if ($haspostingaccess) {
$ret .= "$links{post_to_community} ";
}
- $ret .= "$links{join_community} " unless
$remote->is_identity;
+ unless ($remote->is_identity) {
+ if ($isclosedcommunity) {
+ $ret .= "This is a closed community ";
+ } else {
+ $ret .= "$links{join_community} ";
+ }
+ }
$ret .= $links{unwatch_community};
$ret .= " " . $links{track_community};
} elsif ($memberof) {
@@ -2773,7 +2781,13 @@ sub control_strip
if ($haspostingaccess) {
$ret .= "$links{post_to_community} ";
}
- $ret .= "$links{join_community} " unless
$remote->is_identity;
+ unless ($remote->is_identity) {
+ if ($isclosedcommunity) {
+ $ret .= "This is a closed community ";
+ } else {
+ $ret .= "$links{join_community} ";
+ }
+ }
$ret .= $links{watch_community};
$ret .= " " . $links{track_community};
}
diff -r 20a8b4b428f4 -r f1c730aaded6 htdocs/js/contextualhover.js
--- a/htdocs/js/contextualhover.js Sat Jun 20 15:15:07 2009 +0000
+++ b/htdocs/js/contextualhover.js Sun Jun 21 03:25:39 2009 +0000
@@ -323,26 +323,31 @@ ContextualPopup.renderPopup = function (
// member of community
if (data.is_logged_in && data.is_comm) {
var membership = document.createElement("span");
- var membershipLink = document.createElement("a");
- var membership_action = data.is_member ? "leave" : "join";
+ if (!data.is_closed_membership || data.is_member) {
+ var membershipLink = document.createElement("a");
- if (data.is_member) {
- membershipLink.href = data.url_leavecomm;
- membershipLink.innerHTML = "Leave";
+ var membership_action = data.is_member ? "leave" : "join";
+
+ if (data.is_member) {
+ membershipLink.href = data.url_leavecomm;
+ membershipLink.innerHTML = "Leave";
+ } else {
+ membershipLink.href = data.url_joincomm;
+ membershipLink.innerHTML = "Join community";
+ }
+
+ if (!ContextualPopup.disableAJAX) {
+ DOM.addEventListener(membershipLink, "click", function (e)
{
+ Event.prep(e);
+ Event.stop(e);
+ return ContextualPopup.changeRelation(data,
ctxPopupId, membership_action, e); });
+ }
+
+ membership.appendChild(membershipLink);
} else {
- membershipLink.href = data.url_joincomm;
- membershipLink.innerHTML = "Join community";
+ membership.innerHTML = "Community closed";
}
-
- if (!ContextualPopup.disableAJAX) {
- DOM.addEventListener(membershipLink, "click", function (e) {
- Event.prep(e);
- Event.stop(e);
- return ContextualPopup.changeRelation(data, ctxPopupId,
membership_action, e); });
- }
-
- membership.appendChild(membershipLink);
content.appendChild(membership);
}
diff -r 20a8b4b428f4 -r f1c730aaded6 htdocs/tools/endpoints/ctxpopup.bml
--- a/htdocs/tools/endpoints/ctxpopup.bml Sat Jun 20 15:15:07 2009 +0000
+++ b/htdocs/tools/endpoints/ctxpopup.bml Sun Jun 21 03:25:39 2009 +0000
@@ -103,6 +103,7 @@
$ret{url_joincomm} = "$LJ::SITEROOT/community/join.bml?comm=" .
$u->{user};
$ret{url_leavecomm} = "$LJ::SITEROOT/community/leave.bml?comm=" .
$u->{user};
$ret{is_member} = $remote->member_of( $u ) if $remote;
+ $ret{is_closed_membership} = $u->is_closed_membership;
push @actions, 'join', 'leave';
}
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog