Completed
Push — master ( 439767...1fc2c9 )
by
unknown
02:46
created

post.js ➔ ... ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 4
rs 10
nop 1
1
import path from 'path'
2
3
import {
4
  cmsOperations
5
  ,coreUtils
6
  ,config
7
  ,Manager
8
  ,FileParser
9
} from '../../'
10
11
12
export function unpublish(filePath) {
13
  var tplUrl = FileParser.getFileDataFromUrl(path.join(config.publish.url, filePath))
14
  if(coreUtils.file.exist(tplUrl.json.path)) {
15
    var json = JSON.parse(JSON.stringify(FileParser.getJson(tplUrl.json.path)))
16
    if(typeof json.abe_meta.publish !== 'undefined' && json.abe_meta.publish !== null) {
17
      delete json.abe_meta.publish
18
    }
19
20
    cmsOperations.save.save(
21
      path.join(config.root, config.draft.url, json.abe_meta.link.replace(config.root)),
22
      json.abe_meta.template,
23
      json,
24
      '',
25
      'reject',
26
      null,
27
      'reject'
28
    )
29
    .then((resSave) => {
0 ignored issues
show
Unused Code introduced by
The parameter resSave is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
30
      FileParser.removeFile(tplUrl.publish.path, tplUrl.publish.json)
31
      Manager.instance.updateList()
32
    })
33
  }
34
}