Browse Source

fix: Other user must not able to delete other user's comment except System Manager (#16018)

* fix: Other user must not able to delete other user's comment except Admin

* Update frappe/public/js/frappe/form/footer/form_timeline.js

Co-authored-by: Sagar Vora <sagar@resilient.tech>

* fix: Close condition scope

Co-authored-by: Sagar Vora <sagar@resilient.tech>
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
(cherry picked from commit e4137ca8a1)

# Conflicts:
#	frappe/public/js/frappe/form/footer/form_timeline.js
version-14
Isaiah Galorport 3 years ago
committed by mergify-bot
parent
commit
dbb622fce1
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      frappe/public/js/frappe/form/footer/form_timeline.js

+ 10
- 0
frappe/public/js/frappe/form/footer/form_timeline.js View File

@@ -453,6 +453,7 @@ class FormTimeline extends BaseTimeline {
let edit_wrapper = $(`<div class="comment-edit-box">`).hide();
let edit_box = this.make_editable(edit_wrapper);
let content_wrapper = comment_wrapper.find('.content');
<<<<<<< HEAD
let more_actions_wrapper = comment_wrapper.find('.more-actions');
if (frappe.model.can_delete("Comment")) {
const delete_option = $(`
@@ -461,6 +462,15 @@ class FormTimeline extends BaseTimeline {
${__("Delete")}
</a>
</li>
=======

let delete_button = $();
if (frappe.model.can_delete("Comment") && (frappe.session.user == doc.owner || frappe.user.has_role("System Manager"))) {
delete_button = $(`
<button class="btn btn-link action-btn">
${frappe.utils.icon('close', 'sm')}
</button>
>>>>>>> e4137ca8a1 (fix: Other user must not able to delete other user's comment except System Manager (#16018))
`).click(() => this.delete_comment(doc.name));
more_actions_wrapper.find('.dropdown-menu').append(delete_option);
}


Loading…
Cancel
Save