Skip to content

Commit 66c4f25

Browse files
committed
Add Core Data Model 156
1 parent a95b395 commit 66c4f25

File tree

18 files changed

+939
-16
lines changed

18 files changed

+939
-16
lines changed

MIGRATIONS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
This file documents changes in the data model. Please explain any changes to the
44
data model as well as any custom migrations.
55

6+
## WordPress 156
7+
8+
@kean 2025-10-08
9+
10+
- Remove unused `AbstactPost` properties: `metaIsLocal`, `metaPublishImmediatelly`, `statusAfterSync`, `confirmedChangesHash`
11+
- Remove unused `Blog` properties: `rawBlockEditorSettings`
12+
- Remove unused `BlobEntity`
13+
- Add `metadata` field to `AbstractPost`
14+
- Add `commentsStatus` and `pingsStatus` to `Post`
15+
- Add `formattedSize` to `Media`
16+
617
## WordPress 155
718

819
@crazytonyli 2025-04-07

Modules/Sources/WordPressKitObjC/MediaServiceRemoteREST.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ + (RemoteMedia *)remoteMediaFromJSONDictionary:(NSDictionary *)jsonMedia
412412
remoteMedia.remoteThumbnailURL = [jsonMedia stringForKeyPath:@"thumbnails.fmt_std"];
413413
remoteMedia.videopressGUID = [jsonMedia stringForKey:@"videopress_guid"];
414414
remoteMedia.length = [jsonMedia numberForKey:@"length"];
415+
remoteMedia.formattedSize = [jsonMedia stringForKey:@"size"];
415416
return remoteMedia;
416417
}
417418

Modules/Sources/WordPressKitObjC/PostServiceRemoteREST.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,8 @@ + (RemotePost *)remotePostFromJSONDictionary:(NSDictionary *)jsonPost {
431431
post.format = jsonPost[@"format"];
432432
post.order = [jsonPost numberForKey:@"menu_order"].integerValue;
433433

434+
post.commentsStatus = [jsonPost stringForKeyPath:@"discussion.comment_status"];
435+
post.pingsStatus = [jsonPost stringForKeyPath:@"discussion.ping_status"];
434436
post.commentCount = [jsonPost numberForKeyPath:@"discussion.comment_count"] ?: @0;
435437
post.likeCount = [jsonPost numberForKeyPath:@"like_count"] ?: @0;
436438

Modules/Sources/WordPressKitObjC/include/RemoteMedia.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
@property (nonatomic, strong, nullable) NSString *videopressGUID;
2525
@property (nonatomic, strong, nullable) NSNumber *length;
2626
@property (nonatomic, strong, nullable) NSString *remoteThumbnailURL;
27+
@property (nonatomic, strong, nullable) NSString *formattedSize;
2728

2829
@end

Modules/Sources/WordPressKitObjC/include/RemotePost.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ extern NSString * const PostStatusDeleted;
4545
*/
4646
@property (nonatomic, strong) RemotePostAutosave *autosave;
4747

48+
@property (nonatomic, strong) NSString *commentsStatus;
49+
@property (nonatomic, strong) NSString *pingsStatus;
4850
@property (nonatomic, strong) NSNumber *commentCount;
4951
@property (nonatomic, strong) NSNumber *likeCount;
5052

Sources/WordPressData/Objective-C/AbstractPost.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ @implementation AbstractPost
2323
@dynamic autosaveIdentifier;
2424
@dynamic foreignID;
2525
@dynamic order;
26+
@dynamic rawMetadata;
2627
@synthesize voiceContent;
2728

2829
#pragma mark - Life Cycle Methods

Sources/WordPressData/Objective-C/Blog.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ @implementation Blog
9191
@dynamic quotaSpaceUsed;
9292
@dynamic pageTemplateCategories;
9393
@dynamic publicizeInfo;
94-
@dynamic rawBlockEditorSettings;
9594

9695
@synthesize videoPressEnabled;
9796
@synthesize xmlrpcApi = _xmlrpcApi;

Sources/WordPressData/Objective-C/Media.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ @implementation Media
1616
@dynamic height;
1717
@dynamic filename;
1818
@dynamic filesize;
19+
@dynamic formattedSize;
1920
@dynamic creationDate;
2021
@dynamic blog;
2122
@dynamic posts;

Sources/WordPressData/Objective-C/PostHelper.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ + (void)updatePost:(AbstractPost *)post withRemotePost:(RemotePost *)remotePost
5757
[self updateCommentsForPost:post];
5858
}
5959

60+
// Preserve raw metadata before any field-specific processing
61+
post.rawMetadata = [PostHelper makeRawMetadataFrom:remotePost];
62+
6063
post.autosaveTitle = remotePost.autosave.title;
6164
post.autosaveExcerpt = remotePost.autosave.excerpt;
6265
post.autosaveContent = remotePost.autosave.content;
@@ -69,6 +72,8 @@ + (void)updatePost:(AbstractPost *)post withRemotePost:(RemotePost *)remotePost
6972
pagePost.foreignID = remotePost.foreignID;
7073
} else if ([post isKindOfClass:[Post class]]) {
7174
Post *postPost = (Post *)post;
75+
postPost.commentsStatus = remotePost.commentsStatus;
76+
postPost.pingsStatus = remotePost.pingsStatus;
7277
postPost.commentCount = remotePost.commentCount;
7378
postPost.likeCount = remotePost.likeCount;
7479
postPost.postFormat = remotePost.format;

Sources/WordPressData/Objective-C/include/AbstractPost.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ typedef NS_ENUM(NSUInteger, AbstractPostRemoteStatus) {
5353

5454
@property (nonatomic, strong, nullable) NSDate *confirmedChangesTimestamp;
5555

56+
/// Contains all the custom metadata associated with a post, including the
57+
/// Jetpack plugin metadata.`
58+
@property (nonatomic, strong, nullable) NSData *rawMetadata;
59+
5660
@property (nonatomic, strong, nullable) NSString *voiceContent;
5761

5862
// Revision management

0 commit comments

Comments
 (0)