Skip to content

Commit

Permalink
Merge pull request #1139 from nextcloud/fix-delete-comment-public
Browse files Browse the repository at this point in the history
[fix] delete comments in public polls
  • Loading branch information
dartcafe authored Oct 15, 2020
2 parents 761e813 + 18e51c6 commit 7ebabac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
['name' => 'subscription#set', 'url' => '/subscription', 'verb' => 'POST'],

['name' => 'comment#add', 'url' => '/comment', 'verb' => 'POST'],
['name' => 'comment#delete', 'url' => '/comment/{commentId}', 'verb' => 'DELETE'],
['name' => 'comment#delete', 'url' => '/comment/{commentId}', 'verb' => 'DELETE', 'postfix' => 'auth'],
['name' => 'comment#delete', 'url' => '/comment/s/{token}/{commentId}', 'verb' => 'DELETE', 'postfix' => 'public'],

['name' => 'system#get_site_users_and_groups', 'url' => '/siteusers/get', 'verb' => 'POST'],
['name' => 'system#validate_public_username', 'url' => '/check/username', 'verb' => 'POST'],
Expand Down
9 changes: 7 additions & 2 deletions src/js/store/modules/subModules/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const getters = {
const actions = {
add(context, payload) {
const endPoint = 'apps/polls/comment'

return axios.post(generateUrl(endPoint), {
message: payload.message,
pollId: context.rootState.poll.id,
Expand All @@ -80,9 +81,13 @@ const actions = {
},

delete(context, payload) {
const endPoint = 'apps/polls/comment'
let endPoint = 'apps/polls/comment'
if (context.rootState.poll.acl.token) {
endPoint = endPoint.concat('/s/', context.rootState.poll.acl.token)
}
context.commit('delete', { comment: payload.comment })
return axios.delete(generateUrl(endPoint.concat('/', payload.comment.id)), { token: context.rootState.poll.acl.token })

return axios.delete(generateUrl(endPoint.concat('/', payload.comment.id)))
.then((response) => {
context.commit('delete', { comment: response.data.comment })
return response.data
Expand Down

0 comments on commit 7ebabac

Please sign in to comment.