- Tim Ryan
- Decebal Suiu
- Eric Myrhe
+ - Kevin Walter
settings:
- { name: 'realm.ldap.bindpattern', defaultValue: ' ' }
- { name: 'tickets.closeOnPushCommitMessageRegex', defaultValue: '(?:fixes|closes)[\\s-]+#?(\\d+)' }
+++ /dev/null
-/*\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.models;\r
-\r
-import java.io.Serializable;\r
-import java.util.List;\r
-\r
-/**\r
- * Represents a Gravatar profile.\r
- *\r
- * @author James Moger\r
- *\r
- */\r
-public class GravatarProfile implements Serializable {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public String id;\r
- public String hash;\r
- public String requestHash;\r
- public String displayName;\r
- public String preferredUsername;\r
- public String currentLocation;\r
- public String aboutMe;\r
-\r
- public String profileUrl;\r
- public String thumbnailUrl;\r
- public List<ProfileObject> photos;\r
-// public Map<String, String> profileBackground;\r
-// public Map<String, String> name;\r
-\r
- public List<ProfileObject> phoneNumbers;\r
- public List<ProfileObject> emails;\r
- public List<ProfileObject> ims;\r
- public List<Account> accounts;\r
- public List<ProfileObject> urls;\r
-\r
- public static class ProfileObject implements Serializable {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public String title;\r
- public String type;\r
- public String value;\r
- public boolean primary;\r
-\r
- @Override\r
- public String toString() {\r
- return value;\r
- }\r
- }\r
-\r
- public static class Account implements Serializable {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public String domain;\r
- public String display;\r
- public String url;\r
- public String username;\r
- public String userid;\r
- public boolean verified;\r
- public String shortname;\r
-\r
- @Override\r
- public String toString() {\r
- return display;\r
- }\r
- }\r
-}\r
*/\r
package com.gitblit.utils;\r
\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.lang.reflect.Type;\r
import java.text.DateFormat;\r
import java.text.MessageFormat;\r
import java.text.SimpleDateFormat;\r
import com.gitblit.Keys;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.models.Activity;\r
-import com.gitblit.models.GravatarProfile;\r
import com.gitblit.models.RefModel;\r
import com.gitblit.models.RepositoryCommit;\r
import com.gitblit.models.RepositoryModel;\r
-import com.google.gson.reflect.TypeToken;\r
\r
/**\r
* Utility class for building activity information from repositories.\r
return recentActivity;\r
}\r
\r
- /**\r
- * Returns the Gravatar profile, if available, for the specified email\r
- * address.\r
- *\r
- * @param emailaddress\r
- * @return a Gravatar Profile\r
- * @throws IOException\r
- */\r
- public static GravatarProfile getGravatarProfileFromAddress(String emailaddress)\r
- throws IOException {\r
- return getGravatarProfile(StringUtils.getMD5(emailaddress.toLowerCase()));\r
- }\r
-\r
/**\r
* Creates a Gravatar thumbnail url from the specified email address.\r
*\r
"https://www.gravatar.com/avatar/{0}?s={1,number,0}&d=mm", emailHash, width);\r
return url;\r
}\r
-\r
- /**\r
- * Returns the Gravatar profile, if available, for the specified hashcode.\r
- * address.\r
- *\r
- * @param hash\r
- * the hash of the email address\r
- * @return a Gravatar Profile\r
- * @throws IOException\r
- */\r
- public static GravatarProfile getGravatarProfile(String hash) throws IOException {\r
- String url = MessageFormat.format("https://www.gravatar.com/{0}.json", hash);\r
- // Gravatar has a complex json structure\r
- Type profileType = new TypeToken<Map<String, List<GravatarProfile>>>() {\r
- }.getType();\r
- Map<String, List<GravatarProfile>> profiles = null;\r
- try {\r
- profiles = JsonUtils.retrieveJson(url, profileType);\r
- } catch (FileNotFoundException e) {\r
- }\r
- if (profiles == null || profiles.size() == 0) {\r
- return null;\r
- }\r
- // due to the complex json structure we need to pull out the profile\r
- // from a list 2 levels deep\r
- GravatarProfile profile = profiles.values().iterator().next().get(0);\r
- return profile;\r
- }\r
}\r
+++ /dev/null
-/*\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.tests;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.Test;\r
-\r
-import com.gitblit.models.GravatarProfile;\r
-import com.gitblit.utils.ActivityUtils;\r
-\r
-public class ActivityTest extends GitblitUnitTest {\r
-\r
- @Test\r
- public void testGravatarProfile() throws IOException {\r
- GravatarProfile profile = ActivityUtils.getGravatarProfile("beau@dentedreality.com.au");\r
- assertEquals("beau", profile.preferredUsername);\r
- }\r
-}
\ No newline at end of file