Skip to content

Commit b3ae49c

Browse files
committed
Fixed handling of subsequent releases.
1 parent 7b0df07 commit b3ae49c

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/wordpress.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
var wordpress = require( "wordpress" ),
22
config = require( "./config" );
33

4-
module.exports = wordpress.createClient( config.wordpress );
4+
var client = wordpress.createClient( config.wordpress );
5+
6+
client.getPostForPlugin = function( plugin, fn ) {
7+
client.authenticatedCall( "jq-pjc.getPostForPlugin", plugin, function( error, post ) {
8+
if ( error ) {
9+
return fn( error );
10+
}
11+
12+
fn( null, wordpress.fieldMap.from( post, "post" ) );
13+
});
14+
};
15+
16+
module.exports = client;

src/wp-update.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ actions.addRelease = function( data, fn ) {
109109
function getPageData() {
110110
getPageDetails( this.parallel() );
111111
pluginsDb.getMeta( package.name, this.parallel() );
112-
wordpress.authenticatedCall( "jq-pjc.getPostForPlugin", package.name, this.parallel() );
112+
wordpress.getPostForPlugin( package.name, this.parallel() );
113113
},
114114

115115
function updateMainPage( error, pageDetails, repoMeta, existingPage ) {
@@ -133,10 +133,10 @@ actions.addRelease = function( data, fn ) {
133133
]);
134134
mainPage.customFields = mergeCustomFields( existingCustomFields, mainPage.customFields );
135135

136-
if ( !existingPage ) {
136+
if ( !existingPage.id ) {
137137
wordpress.newPost( mainPage, mainPageCallback );
138138
} else {
139-
wordpres.editPost( existingPage.id, mainPage, function( error ) {
139+
wordpress.editPost( existingPage.id, mainPage, function( error ) {
140140
if ( error ) {
141141
return mainPageCallback( error );
142142
}

0 commit comments

Comments
 (0)