Skip to content

Fixed term move issue #386

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 1 commit into from
Jul 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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