Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 5a0b621

Browse files
authored
Fetching a post on successful update (removes long time TODO) (#163)
* Fetching a post on successful update. * Fixed test. Added file for getPost since now we are calling that method from updatePost
1 parent 807ea5d commit 5a0b621

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

WordPressKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "WordPressKit"
3-
s.version = "4.2.0-beta.1"
3+
s.version = "4.2.0-beta.2"
44
s.summary = "WordPressKit offers a clean and simple WordPress.com and WordPress.org API."
55

66
s.description = <<-DESC

WordPressKit/PostServiceRemoteXMLRPC.m

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,16 @@ - (void)updatePost:(RemotePost *)post
143143
[self.api callMethod:@"metaWeblog.editPost"
144144
parameters:parameters
145145
success:^(id responseObject, NSHTTPURLResponse *httpResponse) {
146-
// TODO: fetch individual post
147-
if (success) {
148-
success(post);
149-
}
146+
[self getPostWithID:post.postID success:^(RemotePost *fetchedPost) {
147+
if (success) {
148+
success(fetchedPost);
149+
}
150+
} failure:^(NSError *error) {
151+
//We failed to fetch the post but the update was successful
152+
if (success) {
153+
success(post);
154+
}
155+
}];
150156
} failure:^(NSError *error, NSHTTPURLResponse *httpResponse) {
151157
if (failure) {
152158
failure(error);

WordPressKitTests/PostServiceRemoteXMLRPCTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class PostServiceRemoteXMLRPCTests: RemoteTestCase, XMLRPCTestable {
259259
let expect = expectation(description: "Update post success")
260260

261261
stubRemoteResponse(XMLRPCTestableConstants.xmlRpcUrl,
262-
filename: updatePostSuccessMockFilename,
262+
files: [updatePostSuccessMockFilename, getPostSuccessMockFilename],
263263
contentType: .XML)
264264

265265
if let remoteInstance = remote as? PostServiceRemote {

0 commit comments

Comments
 (0)