Skip to content

07-07-2025 | Staging #387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 3, 2025
Prev Previous commit
Next Next commit
Fixed term move issue
  • Loading branch information
sunil-lakshman committed Jul 2, 2025
commit 2ae487c08c83ca295bcbd0540945430d0d130ad8
3 changes: 1 addition & 2 deletions lib/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ export const move = (http, type, force = false, params = {}) => {
try {
let updateData = {}
const json = cloneDeep(this)
delete json.parent_uid
if (type) {
updateData[type] = json
} else {
Expand All @@ -328,7 +327,7 @@ export const move = (http, type, force = false, params = {}) => {
if (force === true) {
headers.params.force = true
}
const response = await http.put(`${this.urlPath}/move`, updateData, headers)
const response = await http.put(`${this.urlPath}/move`, param, headers)
if (response.data) {
return new this.constructor(http, parseData(response, this.stackHeaders, this.content_type_uid, this.taxonomy_uid, http))
} else {
Expand Down
11 changes: 6 additions & 5 deletions test/sanity-check/api/terms-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@ describe('Terms API Test', () => {
})

it('should move the term to parent uid passed', done => {
makeTerms(taxonomy.uid, childTerm2.term.uid).fetch()
const term = {
parent_uid: 'term_test_child1',
order: 1
}
makeTerms(taxonomy.uid, childTerm2.term.uid).move({ term, force: true })
.then(async (term) => {
term.parent_uid = null
const moveTerm = await term.move({ force: true })
expect(moveTerm.parent_uid).to.be.equal(null)
expect(term.parent_uid).to.not.equal(null)
done()
return moveTerm
})
.catch(done)
})
Expand Down
Loading