From 1ba4739de9065d1b00aee5e3d6567a612627ac24 Mon Sep 17 00:00:00 2001 From: Vladislav Pozdnyakov Date: Wed, 2 Oct 2013 17:13:53 +0700 Subject: [PATCH 1/2] - fixed "comments disabled" bug --- JoeBlogs/Mapper.cs | 1 + JoeBlogs/classes/Post.cs | 5 +++-- JoeBlogs/xmlRpcStructs/Post.cs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/JoeBlogs/Mapper.cs b/JoeBlogs/Mapper.cs index 555b347..8707f8e 100644 --- a/JoeBlogs/Mapper.cs +++ b/JoeBlogs/Mapper.cs @@ -216,6 +216,7 @@ internal static XmlRpcPost Post(Post input) title = input.Title, permaLink = input.Permalink, post_type = input.PostType, + mt_allow_comments = input.CommentsEnabled ? "open" : "closed", custom_fields = input.CustomFields == null ? null : input.CustomFields.Select(cf => new XmlRpcCustomField() { id = cf.ID, diff --git a/JoeBlogs/classes/Post.cs b/JoeBlogs/classes/Post.cs index 67b0ad2..52a5668 100644 --- a/JoeBlogs/classes/Post.cs +++ b/JoeBlogs/classes/Post.cs @@ -6,8 +6,8 @@ public class Post { public Post() { - DateCreated = DateTime - .Now; + DateCreated = DateTime.Now; + CommentsEnabled = true; } public int PostID { get; set; } @@ -21,6 +21,7 @@ public Post() public CustomField[] CustomFields { get; set; } public Term[] Terms { get; set; } public string PostType { get; set; } + public bool CommentsEnabled { get; set; } public override string ToString() { diff --git a/JoeBlogs/xmlRpcStructs/Post.cs b/JoeBlogs/xmlRpcStructs/Post.cs index 46b5499..d74b161 100644 --- a/JoeBlogs/xmlRpcStructs/Post.cs +++ b/JoeBlogs/xmlRpcStructs/Post.cs @@ -22,7 +22,7 @@ public struct XmlRpcPost public string mt_excerpt; public string mt_text_more; public string wp_more_text; - public int mt_allow_comments; + public string mt_allow_comments; public int mt_allow_pings; public string mt_keywords; public string wp_slug; From 28b745cd23c704a5e734586ebdf639d17b62464c Mon Sep 17 00:00:00 2001 From: Vladislav Pozdnyakov Date: Thu, 10 Oct 2013 18:50:08 +0700 Subject: [PATCH 2/2] - allow to use slug --- JoeBlogs/Mapper.cs | 1 + JoeBlogs/classes/Post.cs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/JoeBlogs/Mapper.cs b/JoeBlogs/Mapper.cs index 8707f8e..a0e9116 100644 --- a/JoeBlogs/Mapper.cs +++ b/JoeBlogs/Mapper.cs @@ -215,6 +215,7 @@ internal static XmlRpcPost Post(Post input) postid = input.PostID, title = input.Title, permaLink = input.Permalink, + wp_slug = input.Slug, post_type = input.PostType, mt_allow_comments = input.CommentsEnabled ? "open" : "closed", custom_fields = input.CustomFields == null ? null : input.CustomFields.Select(cf => new XmlRpcCustomField() diff --git a/JoeBlogs/classes/Post.cs b/JoeBlogs/classes/Post.cs index 52a5668..14e05b7 100644 --- a/JoeBlogs/classes/Post.cs +++ b/JoeBlogs/classes/Post.cs @@ -22,6 +22,8 @@ public Post() public Term[] Terms { get; set; } public string PostType { get; set; } public bool CommentsEnabled { get; set; } + public string Slug { get; set; } + public override string ToString() {