afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-06-20 03:16 pm

[dw-free] Contextual hover on openID should offer grant access instead of subscribe

[commit: http://hg.dwscoalition.org/dw-free/rev/20a8b4b428f4]

http://bugs.dwscoalition.org/show_bug.cgi?id=1029

Show the grant/remove access link for openid users. Show the unwatch link if
we're already watching them.

Patch by [personal profile] yvi.

Files modified:
  • htdocs/js/contextualhover.js
  • htdocs/tools/endpoints/ctxpopup.bml
--------------------------------------------------------------------------------
diff -r d69d9d7483b6 -r 20a8b4b428f4 htdocs/js/contextualhover.js
--- a/htdocs/js/contextualhover.js	Sat Jun 20 14:17:51 2009 +0000
+++ b/htdocs/js/contextualhover.js	Sat Jun 20 15:15:07 2009 +0000
@@ -372,7 +372,7 @@ ContextualPopup.renderPopup = function (
                 var addTrustLink = document.createElement("a");
                 addTrustLink.href = data.url_addtrust;
 
-                if (data.is_person) {
+                if (data.is_person || data.other_is_identity) {
                     trust = document.createElement("span");
                     addTrustLink.innerHTML = "Grant access";
                 }
@@ -395,7 +395,7 @@ ContextualPopup.renderPopup = function (
                 var removeTrustLink = document.createElement("a");
                 removeTrustLink.href = data.url_addtrust;
 
-                if (data.is_person) {
+                if (data.is_person || data.other_is_identity) {
                     trust = document.createElement("span");
                     removeTrustLink.innerHTML = "Remove access";
                 }
@@ -413,7 +413,7 @@ ContextualPopup.renderPopup = function (
                     trust.appendChild(removeTrust);
             }
 
-            if (!data.is_watching) {
+            if (!data.is_watching && !data.other_is_identity) {
                 // add watch link
                 var addWatch = document.createElement("span");
                 var addWatchLink = document.createElement("a");
@@ -433,7 +433,7 @@ ContextualPopup.renderPopup = function (
                 }
 
                 watch.appendChild(addWatch);
-            } else {
+            } else if (data.is_watching) {
                 // remove watch link
                 var removeWatch = document.createElement("span");
                 var removeWatchLink = document.createElement("a");
diff -r d69d9d7483b6 -r 20a8b4b428f4 htdocs/tools/endpoints/ctxpopup.bml
--- a/htdocs/tools/endpoints/ctxpopup.bml	Sat Jun 20 14:17:51 2009 +0000
+++ b/htdocs/tools/endpoints/ctxpopup.bml	Sat Jun 20 15:15:07 2009 +0000
@@ -93,6 +93,8 @@
         $ret{is_watching}   = $remote->watches( $u );
         $ret{is_watched_by} = $u->watches( $remote );
         $ret{is_requester}  = $remote->equals( $u );
+        $ret{other_is_identity} = $u->is_identity;
+        $ret{self_is_identity} = $remote->is_identity;
     }
 
     $ret{is_logged_in}  = $remote ? 1 : 0;
--------------------------------------------------------------------------------