Comment and reply edit option added to the Dashboard discussions#2351
Open
sazedul-haque wants to merge 6 commits into4.0.0-devfrom
Open
Comment and reply edit option added to the Dashboard discussions#2351sazedul-haque wants to merge 6 commits into4.0.0-devfrom
sazedul-haque wants to merge 6 commits into4.0.0-devfrom
Conversation
Implements inline editing for lesson comments: adds editCommentMutation, updateComment API call, editingId state and handleEditComment in discussions.ts; creates a reusable comment-form template for edit/reply forms; updates lesson-comment-card.php and lesson-comment-single.php to show an edit popover, swap comment display with an edit form, and update the comment text element (tutor-lesson-comment-text-<id>) on success. Adds success/error toasts and preserves existing reply behavior.
Introduce loading and management of discussion replies: add new AJAX endpoint (tutor_load_discussion_replies) and Lesson::load_discussion_replies to return rendered replies HTML. Add templates/dashboard/discussions/comment-replies.php to render replies list and sorting UI. Update frontend JS to support reloadReplies (with order/url param handling), handleReplyComment, setEditing, centralized constants, and better mutation handling (use TutorCore.form/toast/modal, track editingFormId/loadingReplies). Add LOAD_DISCUSSION_REPLIES endpoint constant. Update comment form and comment templates to use consistent form IDs, adjusted props (is_pending, cancel behavior, focused handling), and wire reply/edit/delete flows (confirmation modal now sends is_reply). Overall fixes reply reloads, inline editing UX, and error/success feedback.
Rename lesson-comment template files to a generic comment naming and update all references. Files renamed: lesson-comment-card.php -> comment-card.php, lesson-comment-list.php -> comment-list.php, lesson-comment-single.php -> comment-single.php. Updated templates/dashboard/discussions.php to load comment-list.php and comment-single.php when the current tab is 'lesson-comments', and adjusted the tutor_load_template call to use 'dashboard.discussions.comment-card'. This consolidates naming to be more generic and consistent.
Rename and standardize discussion-replies APIs and templates to use 'comment' terminology. Changes: update frontend endpoint constant (LOAD_DISCUSSION_REPLIES -> LOAD_COMMENT_REPLIES), change AJAX action hook and handler in Lesson (tutor_load_discussion_replies -> tutor_load_comment_replies and load_discussion_replies() -> load_comment_replies()), normalize parameter names and validation messages (discussion_id -> comment_id), adjust response data passed to templates (use explicit array keys and remove unused lesson_comment), and update templates to use the provided user_id variable for permission checks. These edits improve naming consistency and data handling for comment replies.
Update dashboard discussion templates to improve popover interactions and unify UI. Remove unused unread flag and add Alpine popover state to the comment card container; reply button now links to the single-comment view. Standardize popover menu items (added spacing class and explicit 20x20 icon sizes) across comment-card, comment-replies, and comment-single. Adjust popover wrapper markup for owner actions. Change comment form to use tutorForm mode 'onSubmit' and tweak layout (added tutor-sm-justify-end) for improved form behavior and alignment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.