mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
accompanying course: fix posting of pinned comment
This commit is contained in:
parent
84f2e1c72a
commit
6d46efa610
@ -203,9 +203,11 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
|||||||
//console.log('### mutation: toggleConfidential');
|
//console.log('### mutation: toggleConfidential');
|
||||||
state.accompanyingCourse.confidential = value;
|
state.accompanyingCourse.confidential = value;
|
||||||
},
|
},
|
||||||
postFirstComment(state, comment) {
|
addPinnedComment(state, value) {
|
||||||
//console.log('### mutation: postFirstComment', comment);
|
state.accompanyingCourse.pinnedComment = value;
|
||||||
state.accompanyingCourse.pinnedComment = comment;
|
},
|
||||||
|
removePinnedComment(state, value) {
|
||||||
|
state.accompanyingCourse.pinnedComment = null;
|
||||||
},
|
},
|
||||||
updateSocialIssues(state, value) {
|
updateSocialIssues(state, value) {
|
||||||
console.log('updateSocialIssues', value);
|
console.log('updateSocialIssues', value);
|
||||||
@ -337,6 +339,35 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
|||||||
throw error;
|
throw error;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Add/remove pinnedComment
|
||||||
|
*/
|
||||||
|
removePinnedComment({ commit, dispatch }) {
|
||||||
|
const body = {};
|
||||||
|
const url = `/api/1.0/person/accompanying-course/${id}/comment.json`;
|
||||||
|
|
||||||
|
return makeFetch('DELETE', url, body)
|
||||||
|
.then((response) => {
|
||||||
|
commit('removePinnedComment');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
commit('catchError', error);
|
||||||
|
throw error;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
addPinnedComment({ commit, dispatch }, payload) {
|
||||||
|
const body = payload ? { type: payload.type, content: payload.content } : {};
|
||||||
|
const url = `/api/1.0/person/accompanying-course/${id}/comment.json`;
|
||||||
|
|
||||||
|
return makeFetch('POST', url, body)
|
||||||
|
.then((response) => {
|
||||||
|
dispatch('patchFirstComment', response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
commit('catchError', error);
|
||||||
|
throw error;
|
||||||
|
})
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* Add/remove/display anonymous requestor
|
* Add/remove/display anonymous requestor
|
||||||
*/
|
*/
|
||||||
@ -606,18 +637,23 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
|||||||
|
|
||||||
return Promise.all(promises);
|
return Promise.all(promises);
|
||||||
},
|
},
|
||||||
postFirstComment({ commit }, payload) {
|
patchFirstComment({ commit }, payload) {
|
||||||
const url = `/api/1.0/person/accompanying-course/${id}.json`
|
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||||
const body = { type: "accompanying_period", pinnedComment: payload }
|
const body = {
|
||||||
|
type: "accompanying_period",
|
||||||
|
pinnedComment: {
|
||||||
|
type: "accompanying_period_comment",
|
||||||
|
id: payload.id
|
||||||
|
}
|
||||||
|
};
|
||||||
return makeFetch('PATCH', url, body)
|
return makeFetch('PATCH', url, body)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
commit('postFirstComment', response.pinnedComment);
|
commit('addPinnedComment', response.pinnedComment);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
commit('catchError', error);
|
commit('catchError', error);
|
||||||
throw error;
|
throw error;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
updateSocialIssues({ state, commit, dispatch }, { payload, body, method }) {
|
updateSocialIssues({ state, commit, dispatch }, { payload, body, method }) {
|
||||||
const url = `/api/1.0/person/accompanying-course/${id}/socialissue.json`;
|
const url = `/api/1.0/person/accompanying-course/${id}/socialissue.json`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user