Permalink
Browse files

TFJ-738 updateFriendship's retweet parameter doesn't take effect

  • Loading branch information...
1 parent 1a87b36 commit 8806e80b599dd96165d4ea42ddc0a6f1f094cdd5 @yusuke committed Dec 12, 2012
@@ -158,6 +158,11 @@ public boolean isSourceNotificationsEnabled() {
return getTarget().isSourceNotificationsEnabled();
}
+ @Override
+ public boolean isWantRetweets() {
+ return getTarget().isWantRetweets();
+ }
+
public RateLimitStatus getRateLimitStatus() {
return getTarget().getRateLimitStatus();
@@ -97,4 +97,12 @@
*/
boolean isSourceNotificationsEnabled();
+ /**
+ * Checks if the retweets from the target user enabled
+ *
+ * @return true if the retweets from the target user enabled
+ * @since Twitter4J 3.0.3
+ */
+ boolean isWantRetweets();
+
}
@@ -489,7 +489,7 @@ public Relationship updateFriendship(long userId, boolean enableDeviceNotificati
new HttpParameter[]{
new HttpParameter("user_id", userId),
new HttpParameter("device", enableDeviceNotification),
- new HttpParameter("retweets", enableDeviceNotification)
+ new HttpParameter("retweets", retweets)
})));
}
@@ -45,6 +45,7 @@
private final boolean sourceFollowedByTarget;
private final long sourceUserId;
private final String sourceUserScreenName;
+ private boolean wantRetweets;
/*package*/ RelationshipJSONImpl(HttpResponse res, Configuration conf) throws TwitterException {
this(res, res.asJSONObject());
@@ -72,6 +73,7 @@
sourceFollowingTarget = getBoolean("following", sourceJson);
sourceFollowedByTarget = getBoolean("followed_by", sourceJson);
sourceNotificationsEnabled = getBoolean("notifications_enabled", sourceJson);
+ wantRetweets = getBoolean("want_retweets", sourceJson);
} catch (JSONException jsone) {
throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
}
@@ -186,6 +188,14 @@ public boolean isSourceNotificationsEnabled() {
return sourceNotificationsEnabled;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isWantRetweets() {
+ return wantRetweets;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -217,8 +217,10 @@ public void testRelationship() throws Exception {
Relationship relationship = twitter1.updateFriendship(id3.screenName, true, true);
assertEquals(id3.screenName, relationship.getTargetUserScreenName());
- relationship = twitter1.updateFriendship(id3.id, true, true);
- assertEquals(id3.screenName, relationship.getTargetUserScreenName());
+ Relationship updatedRelationship = twitter1.updateFriendship(id3.id, false, false);
+ assertEquals(id3.screenName, updatedRelationship.getTargetUserScreenName());
+ assertEquals(false, updatedRelationship.isSourceNotificationsEnabled());
+ assertEquals(false, updatedRelationship.isWantRetweets());
}
public void testIncomingOutgoingFriendships() throws Exception {

0 comments on commit 8806e80

Please sign in to comment.