Skip to content

Commit c9ef261

Browse files
committed
Add RemoteComment as a reponse object in CommentServiceRemote
1 parent cd1458b commit c9ef261

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

Sources/WordPressKit/Services/CommentServiceRemoteREST.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
- (void)updateCommentWithID:(NSNumber * _Nonnull)commentID
3232
content:(NSString * _Nonnull)content
33-
success:(void (^ _Nullable)(void))success
33+
success:(void (^)(RemoteComment *comment))success
3434
failure:(void (^ _Nullable)(NSError * _Nullable error))failure;
3535

3636
/**

Sources/WordPressKit/Services/CommentServiceRemoteREST.m

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ - (void)syncHierarchicalCommentsForPost:(NSNumber *)postID
246246

247247
- (void)updateCommentWithID:(NSNumber *)commentID
248248
content:(NSString *)content
249-
success:(void (^)(void))success
249+
success:(void (^)(RemoteComment *comment))success
250250
failure:(void (^)(NSError *error))failure
251251
{
252252
NSString *path = [NSString stringWithFormat:@"sites/%@/comments/%@", self.siteID, commentID];
@@ -260,14 +260,15 @@ - (void)updateCommentWithID:(NSNumber *)commentID
260260
[self.wordPressComRESTAPI post:requestUrl
261261
parameters:parameters
262262
success:^(id responseObject, NSHTTPURLResponse *httpResponse) {
263-
if (success) {
264-
success();
265-
}
266-
} failure:^(NSError *error, NSHTTPURLResponse *httpResponse) {
267-
if (failure) {
268-
failure(error);
269-
}
270-
}];
263+
RemoteComment *comment = [self remoteCommentFromJSONDictionary:responseObject];
264+
if (success) {
265+
success(comment);
266+
}
267+
} failure:^(NSError *error, NSHTTPURLResponse *httpResponse) {
268+
if (failure) {
269+
failure(error);
270+
}
271+
}];
271272
}
272273

273274
- (void)replyToPostWithID:(NSNumber *)postID

0 commit comments

Comments
 (0)