]> source.dussan.org Git - gitblit.git/commitdiff
Eliminate Gravatar profile linking and improve api
authorJames Moger <james.moger@gitblit.com>
Mon, 3 Mar 2014 22:41:54 +0000 (17:41 -0500)
committerJames Moger <james.moger@gitblit.com>
Mon, 3 Mar 2014 22:51:21 +0000 (17:51 -0500)
releases.moxie
src/main/java/com/gitblit/wicket/GitBlitWebApp.java
src/main/java/com/gitblit/wicket/pages/GravatarProfilePage.html [deleted file]
src/main/java/com/gitblit/wicket/pages/GravatarProfilePage.java [deleted file]
src/main/java/com/gitblit/wicket/pages/RootPage.java
src/main/java/com/gitblit/wicket/panels/DigestsPanel.java
src/main/java/com/gitblit/wicket/panels/GravatarImage.html
src/main/java/com/gitblit/wicket/panels/GravatarImage.java
src/main/java/com/gitblit/wicket/panels/ReflogPanel.java
src/main/java/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java

index cd4e43eaa76cd02c9898a4443adbb9071f8fafef..f7af6cb2eb1b356de51f02015d89386920616050 100644 (file)
@@ -53,6 +53,7 @@ r20: {
        - Revised committer verification to require a matching displayname or account name AND the email address
        - Serve repositories on both /r and /git, displaying /r because it is shorter
        - Eliminate HEAD from the blob, blame, and tree pages. That assumed a resource was available in HEAD and it may not be.
+       - Eliminate Gravatar profile linking.
     additions:
        - Added color modes for the blame page (issue-2)
        - Added an optional MirrorService which will periodically fetch ref updates from source repositories for mirrors (issue-5).  Repositories must be manually cloned using native git and "--mirror".
index 35a0823b90e757084b89596b98a67710e09d1c60..ab5ae2a2261b456eecade0956bd407c067c4cd72 100644 (file)
@@ -53,7 +53,6 @@ import com.gitblit.wicket.pages.FederationRegistrationPage;
 import com.gitblit.wicket.pages.ForkPage;
 import com.gitblit.wicket.pages.ForksPage;
 import com.gitblit.wicket.pages.GitSearchPage;
-import com.gitblit.wicket.pages.GravatarProfilePage;
 import com.gitblit.wicket.pages.HistoryPage;
 import com.gitblit.wicket.pages.LogPage;
 import com.gitblit.wicket.pages.LogoutPage;
@@ -178,7 +177,6 @@ public class GitBlitWebApp extends WebApplication {
                mount("/registration", FederationRegistrationPage.class, "u", "n");
 
                mount("/activity", ActivityPage.class, "r", "h");
-               mount("/gravatar", GravatarProfilePage.class, "h");
                mount("/lucene", LuceneSearchPage.class);
                mount("/project", ProjectPage.class, "p");
                mount("/projects", ProjectsPage.class);
diff --git a/src/main/java/com/gitblit/wicket/pages/GravatarProfilePage.html b/src/main/java/com/gitblit/wicket/pages/GravatarProfilePage.html
deleted file mode 100644 (file)
index b4531a1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml"  \r
-      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"  \r
-      xml:lang="en"  \r
-      lang="en"> \r
-<body>\r
-<wicket:extend>\r
-<div class="container">\r
-       <div class="pageTitle">\r
-               <h2>Gravatar<small> / <span wicket:id="username">[username]</span></small></h2>\r
-       </div>\r
-       <img class="gravatar" wicket:id="profileImage"></img>\r
-       <h2 wicket:id="displayName"></h2>\r
-       <div style="color:#888;"wicket:id="location"></div>\r
-       <div style="padding-top:5px;" wicket:id="aboutMe"></div>\r
-       <p></p>\r
-       <a wicket:id="profileLink"><wicket:message key="gb.completeGravatarProfile">[Complete profile on Gravatar.com]</wicket:message></a>\r
-       <p></p>\r
-</div>\r
-</wicket:extend>\r
-</body>\r
-</html>
\ No newline at end of file
diff --git a/src/main/java/com/gitblit/wicket/pages/GravatarProfilePage.java b/src/main/java/com/gitblit/wicket/pages/GravatarProfilePage.java
deleted file mode 100644 (file)
index 984b297..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*\r
- * Copyright 2011 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.wicket.pages;\r
-\r
-import java.io.IOException;\r
-import java.text.MessageFormat;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.basic.Label;\r
-import org.apache.wicket.markup.html.link.ExternalLink;\r
-\r
-import com.gitblit.models.GravatarProfile;\r
-import com.gitblit.utils.ActivityUtils;\r
-import com.gitblit.wicket.ExternalImage;\r
-import com.gitblit.wicket.WicketUtils;\r
-\r
-/**\r
- * Gravatar Profile Page shows the Gravatar information, if available.\r
- *\r
- * @author James Moger\r
- *\r
- */\r
-public class GravatarProfilePage extends RootPage {\r
-\r
-       public GravatarProfilePage(PageParameters params) {\r
-               super();\r
-               setupPage("", "");\r
-               String object = WicketUtils.getObject(params);\r
-               GravatarProfile profile = null;\r
-               try {\r
-                       if (object.indexOf('@') > -1) {\r
-                               profile = ActivityUtils.getGravatarProfileFromAddress(object);\r
-                       } else {\r
-                               profile = ActivityUtils.getGravatarProfile(object);\r
-                       }\r
-               } catch (IOException e) {\r
-                       error(MessageFormat.format(getString("gb.failedToFindGravatarProfile"), object), e, true);\r
-               }\r
-\r
-               if (profile == null) {\r
-                       error(MessageFormat.format(getString("gb.failedToFindGravatarProfile"), object), true);\r
-               }\r
-               add(new Label("displayName", profile.displayName));\r
-               add(new Label("username", profile.preferredUsername));\r
-               add(new Label("location", profile.currentLocation));\r
-               add(new Label("aboutMe", profile.aboutMe));\r
-               ExternalImage image = new ExternalImage("profileImage", profile.thumbnailUrl + "?s=256&d=identicon");\r
-               add(image);\r
-               add(new ExternalLink("profileLink", profile.profileUrl));\r
-       }\r
-}\r
index 9141b4e310ba8a06df637c038300995710c79d36..5ccc3a4cded3ac19029ca0b914d3c9b03491c7fa 100644 (file)
@@ -576,8 +576,7 @@ public abstract class RootPage extends BasePage {
                        boolean standardLogin = session.authenticationType.isStandard();\r
 \r
                        if (app().settings().getBoolean(Keys.web.allowGravatar, true)) {\r
-                               add(new GravatarImage("username", user.getDisplayName(),\r
-                                               user.emailAddress, "navbarGravatar", 20, false, false));\r
+                               add(new GravatarImage("username", user, "navbarGravatar", 20, false));\r
                        } else {\r
                                add(new Label("username", user.getDisplayName()));\r
                        }\r
index ee97635f8e7523461ab72431de622c8e6dac6ab8..de09aa9510eef39e3e88a5541f2f9d2c366b2061 100644 (file)
@@ -203,8 +203,7 @@ public class DigestsPanel extends BasePanel {
                                                final RepositoryCommit commit = commitItem.getModelObject();\r
 \r
                                                // author gravatar\r
-                                               commitItem.add(new GravatarImage("commitAuthor", commit.getAuthorIdent().getName(),\r
-                                                               commit.getAuthorIdent().getEmailAddress(), null, 16, false, false));\r
+                                               commitItem.add(new GravatarImage("commitAuthor", commit.getAuthorIdent(), null, 16, false));\r
 \r
                                                // merge icon\r
                                                if (commit.getParentCount() > 1) {\r
index 9dda7958657cc35c700f7de08850247e48a95c6f..846a8f1b3666d6f4a3b3d441a3b0223ab54baeba 100644 (file)
@@ -4,6 +4,6 @@
       xml:lang="en"  \r
       lang="en">\r
 <wicket:panel>\r
-<a href="#" wicket:id="link"><img wicket:id="image"></img></a>\r
+<img wicket:id="image"></img>\r
 </wicket:panel>\r
 </html>
\ No newline at end of file
index 34af2bfba9642c35f99205cf6d7e235e814a09c3..9507a25e085b414a41fdd04ddc284620d13aea7c 100644 (file)
  */\r
 package com.gitblit.wicket.panels;\r
 \r
-import java.text.MessageFormat;\r
-\r
-import org.apache.wicket.behavior.SimpleAttributeModifier;\r
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
-import org.apache.wicket.markup.html.link.Link;\r
 import org.eclipse.jgit.lib.PersonIdent;\r
 \r
 import com.gitblit.Keys;\r
+import com.gitblit.models.UserModel;\r
 import com.gitblit.utils.ActivityUtils;\r
-import com.gitblit.utils.StringUtils;\r
 import com.gitblit.wicket.ExternalImage;\r
 import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.pages.GravatarProfilePage;\r
 \r
 /**\r
- * Represents a Gravatar image and links to the Gravatar profile page.\r
+ * Represents a Gravatar image.\r
  *\r
  * @author James Moger\r
  *\r
@@ -44,21 +38,21 @@ public class GravatarImage extends BasePanel {
        }\r
 \r
        public GravatarImage(String id, PersonIdent person, int width) {\r
-               this(id, person, width, true);\r
+               this(id, person.getName(), person.getEmailAddress(), "gravatar", width, true);\r
+       }\r
+\r
+       public GravatarImage(String id, PersonIdent person, String cssClass, int width, boolean identicon) {\r
+               this(id, person.getName(), person.getEmailAddress(), cssClass, width, identicon);\r
        }\r
 \r
-       public GravatarImage(String id, PersonIdent person, int width, boolean linked) {\r
-               this(id, person.getName(), person.getEmailAddress(), "gravatar", width, linked, true);\r
+       public GravatarImage(String id, UserModel user, String cssClass, int width, boolean identicon) {\r
+               this(id, user.getDisplayName(), user.emailAddress, cssClass, width, identicon);\r
        }\r
 \r
-       public GravatarImage(String id, String username, String emailaddress, String cssClass, int width, boolean linked, boolean identicon) {\r
+       public GravatarImage(String id, String username, String emailaddress, String cssClass, int width, boolean identicon) {\r
                super(id);\r
 \r
                String email = emailaddress == null ? username.toLowerCase() : emailaddress.toLowerCase();\r
-               String hash = StringUtils.getMD5(email);\r
-               Link<Void> link = new BookmarkablePageLink<Void>("link", GravatarProfilePage.class,\r
-                               WicketUtils.newObjectParameter(hash));\r
-               link.add(new SimpleAttributeModifier("target", "_blank"));\r
                String url;\r
                if (identicon) {\r
                        url = ActivityUtils.getGravatarIdenticonUrl(email, width);\r
@@ -69,14 +63,8 @@ public class GravatarImage extends BasePanel {
                if (cssClass != null) {\r
                        WicketUtils.setCssClass(image, cssClass);\r
                }\r
-               link.add(image);\r
-               if (linked) {\r
-                       WicketUtils.setHtmlTooltip(link,\r
-                               MessageFormat.format("View Gravatar profile for {0}", username));\r
-               } else {\r
-                       WicketUtils.setHtmlTooltip(link, username);\r
-               }\r
-               add(link.setEnabled(linked));\r
+               add(image);\r
+               WicketUtils.setHtmlTooltip(image, username);\r
                setVisible(app().settings().getBoolean(Keys.web.allowGravatar, true));\r
        }\r
 }
\ No newline at end of file
index 70f598634aedbf7161423a41f8456874f2c798f1..c1db726ac8a578ba8d64c89a80ce8c0d937779bd 100644 (file)
@@ -259,8 +259,7 @@ public class ReflogPanel extends BasePanel {
                                                final RepositoryCommit commit = commitItem.getModelObject();\r
 \r
                                                // author gravatar\r
-                                               commitItem.add(new GravatarImage("commitAuthor", commit.getAuthorIdent().getName(),\r
-                                                               commit.getAuthorIdent().getEmailAddress(), null, 16, false, false));\r
+                                               commitItem.add(new GravatarImage("commitAuthor", commit.getAuthorIdent(), null, 16, false));\r
 \r
                                                // merge icon\r
                                                if (commit.getParentCount() > 1) {\r
index 756b7db4b2f0700d70d3b21a8c2249bd62e0f8ef..f37cc2aa00a2e0f8d78eaa2b2086d311003e0bf8 100644 (file)
@@ -145,7 +145,7 @@ public class RegistrantPermissionsPanel extends BasePanel {
                                        }
 
                                        Fragment userFragment = new Fragment("registrant", "userRegistrant", RegistrantPermissionsPanel.this);
-                                       userFragment.add(new GravatarImage("userAvatar", ident, 20, false));
+                                       userFragment.add(new GravatarImage("userAvatar", ident, 20));
                                        userFragment.add(new Label("userName", entry.registrant));
                                        item.add(userFragment);
                                } else {