[PR #261] [MERGED] Leave comments on someone elses pages #47 #5621

Closed
opened 2026-02-05 10:12:31 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/261
Author: @Abijeet
Created: 1/1/2017
Status: Merged
Merged: 8/1/2017
Merged by: @ssddanbrown

Base: masterHead: master


📝 Commits (10+)

📊 Changes

42 files changed (+1420 additions, -11 deletions)

View changed files

📝 .gitignore (+2 -3)
app/Comment.php (+96 -0)
app/Http/Controllers/CommentController.php (+99 -0)
📝 app/Http/Controllers/PageController.php (+2 -2)
📝 app/Page.php (+4 -0)
app/Repos/CommentRepo.php (+105 -0)
📝 app/Services/PermissionService.php (+1 -1)
📝 database/factories/ModelFactory.php (+10 -0)
database/migrations/2017_01_01_130541_create_comments_table.php (+112 -0)
database/migrations/2017_06_04_060012_comments_add_active_col.php (+38 -0)
📝 database/seeds/DummyContentSeeder.php (+4 -1)
📝 gulpfile.js (+2 -0)
📝 resources/assets/js/controllers.js (+221 -0)
📝 resources/assets/js/directives.js (+124 -0)
📝 resources/assets/js/pages/page-show.js (+2 -0)
resources/assets/sass/_comments.scss (+82 -0)
📝 resources/assets/sass/_pages.scss (+4 -0)
📝 resources/assets/sass/_variables.scss (+3 -0)
📝 resources/assets/sass/export-styles.scss (+1 -0)
📝 resources/assets/sass/styles.scss (+1 -0)

...and 22 more files

📄 Description

These page contains details for the implementation of the comments section for BookStack. Issue is here.

Functionality to implement

  • Add a simple editor with Markdown support.
  • Ability to add comments.
  • Ability to edit own comments.
  • Ability to delete your own comments
  • Ability to link directly to a comment in the page
  • Ability to reply to a comment (upto 2 levels?)
  • Display total comments on the page summary maybe.
  • User should not be able to edit other's comments.

Future enhancements

  • Comment change history
  • Add roles to comment.
  • Inline document comments where users can highlight sections of pages and comment on tThis is sparta!hose.
  • Like comments
  • Highlight people via your comments with a "@Abijeet", similar to Facebook.

Database schema

The database schema will be a simple tree based schema.

Reviewed various tree based schema's structure for SQL described here http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/

After analyzing the various schema structures, I've finally decided to go ahead with the Adjacency List based on its simplicity. Following will be the schema structure -

data-model

Task list

Breaking down the whole thing into smaller tasks,

  • Create the migration script.
    • Table name is comments.
  • Create the comment entity (extends Ownable).
  • Create the comment repo.
  • Create the permissions for comments, which will be the same as attachments.
  • Create the comments controller with the following methods,
    • add
    • update
    • delete
    • getLastXComments
    • getChildComments
  • Create the views
    • Create a directive with simple markdown editor to save markdown based comments.
    • Replying to a comment.
    • Editing a comment.
  • Permissions
  • Allow direct linking to a comment
  • Implement translations
  • Manual tests
  • Automated tests
  • Running load tests
  • Setting up the demo data.
  • Code cleanup
  • Code review by @ssddanbrown
  • Merge with master
  • Update documentation

@ssddanbrown - Please do not merge this, I'll let you know when this is ready to be merged.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/261 **Author:** [@Abijeet](https://github.com/Abijeet) **Created:** 1/1/2017 **Status:** ✅ Merged **Merged:** 8/1/2017 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (10+) - [`4cc7365`](https://github.com/BookStackApp/BookStack/commit/4cc73657a1298e6411901075416be0596d0e9139) Merge pull request #1 from ssddanbrown/master - [`d2efc2f`](https://github.com/BookStackApp/BookStack/commit/d2efc2f47f0c3e1d4d2df0255db392b8e31e3666) Merge pull request #2 from BookStackApp/master - [`581881d`](https://github.com/BookStackApp/BookStack/commit/581881d0cae139bb634288590ae949270c39d715) Merging gitignore. - [`cd6572b`](https://github.com/BookStackApp/BookStack/commit/cd6572b61af2165133468d2562d04dffdca8fca8) Merge pull request #3 from BookStackApp/master - [`397db04`](https://github.com/BookStackApp/BookStack/commit/397db0442853bcca281687fd2f97614e925d0dfd) Added comments controller, model, repo, and the database schema. Modified existing Page model to associate with comments. - [`e5c4e0a`](https://github.com/BookStackApp/BookStack/commit/e5c4e0ac86cdfc9399ee11ca07d1dea7d2151e8e) Merge pull request #6 from BookStackApp/master - [`70991fc`](https://github.com/BookStackApp/BookStack/commit/70991fc1e54686fb0c50550df8aba2296a75ebb2) Merge branch 'master' of https://github.com/Abijeet/BookStack - [`1483500`](https://github.com/BookStackApp/BookStack/commit/148350009c89eadbc1b14ff5630e06da26f71b2c) #47 Adds comment permission to each role. - [`388f2f4`](https://github.com/BookStackApp/BookStack/commit/388f2f40dc88727d18eeb7865dd1088691a3459e) Merge pull request #7 from BookStackApp/master - [`410e967`](https://github.com/BookStackApp/BookStack/commit/410e967eb10b87e43087f77569b662c9745a4b1e) Merge branch 'master' of https://github.com/Abijeet/BookStack ### 📊 Changes **42 files changed** (+1420 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+2 -3) ➕ `app/Comment.php` (+96 -0) ➕ `app/Http/Controllers/CommentController.php` (+99 -0) 📝 `app/Http/Controllers/PageController.php` (+2 -2) 📝 `app/Page.php` (+4 -0) ➕ `app/Repos/CommentRepo.php` (+105 -0) 📝 `app/Services/PermissionService.php` (+1 -1) 📝 `database/factories/ModelFactory.php` (+10 -0) ➕ `database/migrations/2017_01_01_130541_create_comments_table.php` (+112 -0) ➕ `database/migrations/2017_06_04_060012_comments_add_active_col.php` (+38 -0) 📝 `database/seeds/DummyContentSeeder.php` (+4 -1) 📝 `gulpfile.js` (+2 -0) 📝 `resources/assets/js/controllers.js` (+221 -0) 📝 `resources/assets/js/directives.js` (+124 -0) 📝 `resources/assets/js/pages/page-show.js` (+2 -0) ➕ `resources/assets/sass/_comments.scss` (+82 -0) 📝 `resources/assets/sass/_pages.scss` (+4 -0) 📝 `resources/assets/sass/_variables.scss` (+3 -0) 📝 `resources/assets/sass/export-styles.scss` (+1 -0) 📝 `resources/assets/sass/styles.scss` (+1 -0) _...and 22 more files_ </details> ### 📄 Description These page contains details for the implementation of the comments section for BookStack. Issue is [here](https://github.com/ssddanbrown/BookStack/issues/47). ## Functionality to implement - Add a simple editor with Markdown support. - Ability to add comments. - Ability to edit own comments. - Ability to delete your own comments - Ability to link directly to a comment in the page - Ability to reply to a comment (upto 2 levels?) - Display total comments on the page summary maybe. - User should not be able to edit other's comments. ### Future enhancements - Comment change history - Add roles to comment. - Inline document comments where users can highlight sections of pages and comment on tThis is sparta!hose. - Like comments - Highlight people via your comments with a "@Abijeet", similar to Facebook. ## Database schema The database schema will be a simple tree based schema. Reviewed various tree based schema's structure for SQL described here http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/ After analyzing the various schema structures, I've finally decided to go ahead with the Adjacency List based on its simplicity. Following will be the schema structure - ![data-model](https://cloud.githubusercontent.com/assets/1685517/21581234/165bd510-d04f-11e6-8fc1-45958ed58b38.png) ## Task list Breaking down the whole thing into smaller tasks, - [x] Create the migration script. - Table name is `comments`. - [x] Create the comment entity (extends Ownable). - [x] Create the comment repo. - [x] Create the permissions for comments, which will be the same as attachments. - [x] Create the comments controller with the following methods, - [x] add - [x] update - [x] delete - [x] getLastXComments - [x] getChildComments - [x] Create the views - [x] Create a directive with simple markdown editor to save markdown based comments. - [x] Replying to a comment. - [x] Editing a comment. - [x] Permissions - [x] Allow direct linking to a comment - [x] Implement translations - [x] Manual tests - [x] Automated tests - [x] Running load tests - [ ] Setting up the demo data. - [x] Code cleanup - [x] Code review by @ssddanbrown - [x] Merge with master - [ ] Update documentation @ssddanbrown - Please do not merge this, I'll let you know when this is ready to be merged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:12:31 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5621