Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 8806e80b599dd96165d4ea42ddc0a6f1f094cdd5 1 parent 1a87b36
@yusuke authored
View
5 twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyRelationship.java
@@ -158,6 +158,11 @@ public boolean isSourceNotificationsEnabled() {
return getTarget().isSourceNotificationsEnabled();
}
+ @Override
+ public boolean isWantRetweets() {
+ return getTarget().isWantRetweets();
+ }
+
public RateLimitStatus getRateLimitStatus() {
return getTarget().getRateLimitStatus();
View
8 twitter4j-core/src/main/java/twitter4j/Relationship.java
@@ -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();
+
}
View
2  twitter4j-core/src/main/java/twitter4j/TwitterImpl.java
@@ -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)
})));
}
View
10 twitter4j-core/src/main/java/twitter4j/internal/json/RelationshipJSONImpl.java
@@ -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;
View
6 twitter4j-core/src/test/java/twitter4j/FriendsFollowersResourcesTest.java
@@ -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 {
Please sign in to comment.
Something went wrong with that request. Please try again.