datopian / frontend-v2

CKAN / Data Portal frontend as microservice in pure Javascript (Node).
http://tech.datopian.com/frontend/
MIT License
38 stars 18 forks source link

[CMS][WP] Ability to view draft pages #161

Closed anuveyatsu closed 3 years ago

anuveyatsu commented 4 years ago

When I'm preparing pages in the WordPress, I want to view draft pages in my staging/test site, so that I can make sure it looks great prior to publishing it in production.

Acceptance criteria

Tasks

Analysis

Set up baseQuery in CMS model constructor so that it's used by all methods:

https://github.com/datopian/frontend-v2/blob/master/plugins/wp/cms.js#L9-L11

constructor() {
  this.blog = wpcom.site(config.get('WP_URL'))
  this.baseQuery = {
    status: 'publish' + config.get('WP_SHOW_DRAFT') ? ',draft' : ''
  }
}

Then it should be used by all methods:

async getListOfPostsWithMeta(query) {
  return await this.blog.postsList(Object.assign(this.baseQuery, query))
}
sagargg-zz commented 3 years ago

Already implemented. https://github.com/datopian/frontend-v2/blob/master/plugins/wp/cms.js#L9-L14