summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-14 13:41:40 (EDT)
committer Chris Aniszczyk2011-04-14 16:44:20 (EDT)
commit70ccb0fa02bcec80a4022d4205285e14b320b4f0 (patch)
treec459a59d08b7a7e613755b9ee0f652c8dbb91c30
parentee044799233ffcb280aa4a027568631a215b693a (diff)
downloadegit-github-70ccb0fa02bcec80a4022d4205285e14b320b4f0.zip
egit-github-70ccb0fa02bcec80a4022d4205285e14b320b4f0.tar.gz
egit-github-70ccb0fa02bcec80a4022d4205285e14b320b4f0.tar.bz2
Update Gist field from author to userrefs/changes/17/3117/2
This was changed on the server-side JSON format. Change-Id: Id9373d741eab1d27d028ba682defb3badf042e43 Signed-off-by: Kevin Sawicki <kevin@github.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java14
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java2
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttribute.java10
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistConnector.java4
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java16
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/Messages.java3
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/messages.properties1
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistJob.java2
8 files changed, 39 insertions, 13 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java
index f00c2b1..5eeeb6d 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java
@@ -41,7 +41,7 @@ public class Gist {
private String url;
- private User author;
+ private User user;
/**
* @return isPublic
@@ -141,18 +141,18 @@ public class Gist {
}
/**
- * @return author
+ * @return user
*/
- public User getAuthor() {
- return this.author;
+ public User getUser() {
+ return this.user;
}
/**
- * @param author
+ * @param user
* @return this gist
*/
- public Gist setAuthor(User author) {
- this.author = author;
+ public Gist setUser(User user) {
+ this.user = user;
return this;
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java
index 8cc848b..02fe9aa 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java
@@ -75,7 +75,7 @@ public class GistService {
*/
public Gist createGist(Gist gist) throws IOException {
StringBuilder uri = new StringBuilder();
- User user = gist.getAuthor();
+ User user = gist.getUser();
if (user != null) {
uri.append(IGitHubConstants.SEGMENT_USERS);
uri.append('/').append(user.getLogin());
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttribute.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttribute.java
index 642d14a..d3f2fa5 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttribute.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttribute.java
@@ -28,7 +28,15 @@ public enum GistAttribute {
* Gist author
*/
AUTHOR(TaskAttribute.USER_REPORTER, Messages.GistAttribute_LabelAuthor,
- TaskAttribute.TYPE_PERSON, TaskAttribute.KIND_PEOPLE, true),
+ TaskAttribute.TYPE_PERSON, true),
+
+ /**
+ * Gist author gravatar url
+ */
+ AUTHOR_GRAVATAR(
+ "github.gist.reporter.avatar", //$NON-NLS-1$
+ Messages.GistAttribute_LabelAuthorGravatar, TaskAttribute.TYPE_URL,
+ true),
/**
* Gist created date
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistConnector.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistConnector.java
index c962d72..f8a42fd 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistConnector.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistConnector.java
@@ -118,7 +118,7 @@ public class GistConnector extends AbstractRepositoryConnector {
TaskData data = new TaskData(mapper, getConnectorKind(),
repository.getUrl(), gist.getRepo());
data.setPartial(false);
- this.dataHandler.fillTaskData(data, gist);
+ this.dataHandler.fillTaskData(repository, data, gist);
if (gist.getComments() > 0)
this.dataHandler.fillComments(repository, data,
service.getComments(gist.getRepo()));
@@ -176,7 +176,7 @@ public class GistConnector extends AbstractRepositoryConnector {
TaskData data = new TaskData(mapper, getConnectorKind(),
repository.getUrl(), gist.getRepo());
data.setPartial(true);
- this.dataHandler.fillTaskData(data, gist);
+ this.dataHandler.fillTaskData(repository, data, gist);
collector.accept(data);
}
} catch (IOException e) {
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java
index 60f8299..901e9d9 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java
@@ -85,11 +85,13 @@ public class GistTaskDataHandler extends AbstractTaskDataHandler {
/**
* Fill task data with data from gist
*
+ * @param repository
* @param data
* @param gist
* @return specified task data
*/
- public TaskData fillTaskData(TaskData data, Gist gist) {
+ public TaskData fillTaskData(TaskRepository repository, TaskData data,
+ Gist gist) {
TaskAttributeMapper mapper = data.getAttributeMapper();
TaskAttribute key = GistAttribute.KEY.create(data);
@@ -104,6 +106,18 @@ public class GistTaskDataHandler extends AbstractTaskDataHandler {
TaskAttribute url = GistAttribute.URL.create(data);
url.setValue(getGistUrl(data.getRepositoryUrl(), gist));
+ User user = gist.getUser();
+ if (user != null) {
+ TaskAttribute reporter = GistAttribute.AUTHOR.create(data);
+ IRepositoryPerson reporterPerson = repository.createPerson(user
+ .getLogin());
+ reporterPerson.setName(user.getName());
+ mapper.setRepositoryPerson(reporter, reporterPerson);
+
+ TaskAttribute gravatar = GistAttribute.AUTHOR_GRAVATAR.create(data);
+ mapper.setValue(gravatar, user.getGravatarUrl());
+ }
+
GistAttribute.COMMENT_NEW.create(data);
return data;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/Messages.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/Messages.java
index 292e59c..26e2e10 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/Messages.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/Messages.java
@@ -23,6 +23,9 @@ public class Messages extends NLS {
public static String GistAttribute_LabelAuthor;
/** */
+ public static String GistAttribute_LabelAuthorGravatar;
+
+ /** */
public static String GistAttribute_LabelCreated;
/** */
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/messages.properties b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/messages.properties
index e20438c..9321b0b 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/messages.properties
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/messages.properties
@@ -1,4 +1,5 @@
GistAttribute_LabelAuthor=Author:
+GistAttribute_LabelAuthorGravatar=Author
GistAttribute_LabelCreated=Created:
GistAttribute_LabelDescription=Description:
GistAttribute_LabelKey=Key
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistJob.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistJob.java
index 409f16a..94e516e 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistJob.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistJob.java
@@ -47,7 +47,7 @@ public class CreateGistJob extends Job {
try {
Gist gist = new Gist().setPublic(true);
if (user != null)
- gist.setAuthor(new User().setLogin(user));
+ gist.setUser(new User().setLogin(user));
gist.setDescription(title);
GistFile file = new GistFile().setContent(content);
gist.setFiles(Collections.singletonMap(title, file));