[PR #3499] [MERGED] Chapter and Book Conversion Actions #6211

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

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/3499
Author: @ssddanbrown
Created: 6/13/2022
Status: Merged
Merged: 6/20/2022
Merged by: @ssddanbrown

Base: developmentHead: convert_hierachy


📝 Commits (10+)

  • d676e1e Started work on hierachy conversion actions
  • 90ec406 Added clone of entity permissions on chapter/book promotion
  • 8da856b Got chapter conversion to books working
  • 8c67011 Got book to shelf conversions working
  • f145ffc Extracted conversion text to translation file
  • 663f81a Added tests to cover convert functionality
  • 65d4505 Added tests and doc updates for shelf/book cover image API abilities
  • 85f59b5 Added tests for content conversion action permissions
  • ba25dda Applied styleci changes for conversion work
  • 388343a Fixed failing tests after conversion changes

📊 Changes

25 files changed (+566 additions, -122 deletions)

View changed files

📝 app/Actions/ActivityType.php (+2 -0)
📝 app/Entities/Repos/BookRepo.php (+6 -0)
📝 app/Entities/Repos/BookshelfRepo.php (+6 -15)
📝 app/Entities/Repos/PageRepo.php (+0 -17)
📝 app/Entities/Tools/Cloner.php (+39 -37)
app/Entities/Tools/HierarchyTransformer.php (+87 -0)
📝 app/Entities/Tools/TrashCan.php (+1 -1)
📝 app/Http/Controllers/Api/BookApiController.php (+24 -15)
📝 app/Http/Controllers/Api/BookshelfApiController.php (+26 -17)
📝 app/Http/Controllers/BookController.php (+26 -5)
📝 app/Http/Controllers/BookshelfController.php (+12 -7)
📝 app/Http/Controllers/ChapterController.php (+16 -0)
📝 resources/lang/en/activities.php (+4 -0)
📝 resources/lang/en/entities.php (+12 -0)
📝 resources/views/books/edit.blade.php (+6 -1)
resources/views/books/parts/convert-to-shelf.blade.php (+26 -0)
📝 resources/views/chapters/edit.blade.php (+5 -1)
resources/views/chapters/parts/convert-to-book.blade.php (+28 -0)
📝 routes/web.php (+2 -0)
📝 tests/Api/BooksApiTest.php (+38 -0)

...and 5 more files

📄 Description

This is primarily intended to add actions for converting chapters to books, and books to shelves as per #1087.

Considerations

  • When a book is converted to a shelf, The book will remain if it contains any direct child pages but will have Pages appended to the name and this book will be added to the new "Converted" shelf.
  • These changes additionally bring in availability to set/update book/shelf cover images via the API.

TODO

These are in-addition to the in-code todos.

  • Move added text to translations.
  • Add tests to cover newly available API shelf/book cover image params.
  • We should show a warning in regards to the difference in permissions for shelves when promoting a book.
  • We should shown a warning about handling direct pages when promoting a book.
  • Test setting book cover image from API
    • Ensure we can update without resetting image accidentally
    • Ensure api docs correct.
    • As all above but for shelves.
  • Add tests to cover each require route permission.

🔄 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/3499 **Author:** [@ssddanbrown](https://github.com/ssddanbrown) **Created:** 6/13/2022 **Status:** ✅ Merged **Merged:** 6/20/2022 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `development` ← **Head:** `convert_hierachy` --- ### 📝 Commits (10+) - [`d676e1e`](https://github.com/BookStackApp/BookStack/commit/d676e1e824e0377cfcb1736dd1ff622e383d8d02) Started work on hierachy conversion actions - [`90ec406`](https://github.com/BookStackApp/BookStack/commit/90ec40691a6e523475d336a8ffb8280c05347b98) Added clone of entity permissions on chapter/book promotion - [`8da856b`](https://github.com/BookStackApp/BookStack/commit/8da856bac3f7d76dcefbb097dd93bd6409c6ccc9) Got chapter conversion to books working - [`8c67011`](https://github.com/BookStackApp/BookStack/commit/8c67011a1d1187f6300c19c3601ecd421fcf4f09) Got book to shelf conversions working - [`f145ffc`](https://github.com/BookStackApp/BookStack/commit/f145ffc93004707257b03773c70255e73909c9ed) Extracted conversion text to translation file - [`663f81a`](https://github.com/BookStackApp/BookStack/commit/663f81a2b1eba75883fbab6577a386351b86f623) Added tests to cover convert functionality - [`65d4505`](https://github.com/BookStackApp/BookStack/commit/65d4505079c8c5616c98c14e795fe33acb95e8cf) Added tests and doc updates for shelf/book cover image API abilities - [`85f59b5`](https://github.com/BookStackApp/BookStack/commit/85f59b5275da9cc27e8823b22c6a5def4ade1311) Added tests for content conversion action permissions - [`ba25dda`](https://github.com/BookStackApp/BookStack/commit/ba25dda0313d257d9361f66993af15c00a53ce85) Applied styleci changes for conversion work - [`388343a`](https://github.com/BookStackApp/BookStack/commit/388343aeb0e618ee379b8197eafce83ad632290b) Fixed failing tests after conversion changes ### 📊 Changes **25 files changed** (+566 additions, -122 deletions) <details> <summary>View changed files</summary> 📝 `app/Actions/ActivityType.php` (+2 -0) 📝 `app/Entities/Repos/BookRepo.php` (+6 -0) 📝 `app/Entities/Repos/BookshelfRepo.php` (+6 -15) 📝 `app/Entities/Repos/PageRepo.php` (+0 -17) 📝 `app/Entities/Tools/Cloner.php` (+39 -37) ➕ `app/Entities/Tools/HierarchyTransformer.php` (+87 -0) 📝 `app/Entities/Tools/TrashCan.php` (+1 -1) 📝 `app/Http/Controllers/Api/BookApiController.php` (+24 -15) 📝 `app/Http/Controllers/Api/BookshelfApiController.php` (+26 -17) 📝 `app/Http/Controllers/BookController.php` (+26 -5) 📝 `app/Http/Controllers/BookshelfController.php` (+12 -7) 📝 `app/Http/Controllers/ChapterController.php` (+16 -0) 📝 `resources/lang/en/activities.php` (+4 -0) 📝 `resources/lang/en/entities.php` (+12 -0) 📝 `resources/views/books/edit.blade.php` (+6 -1) ➕ `resources/views/books/parts/convert-to-shelf.blade.php` (+26 -0) 📝 `resources/views/chapters/edit.blade.php` (+5 -1) ➕ `resources/views/chapters/parts/convert-to-book.blade.php` (+28 -0) 📝 `routes/web.php` (+2 -0) 📝 `tests/Api/BooksApiTest.php` (+38 -0) _...and 5 more files_ </details> ### 📄 Description This is primarily intended to add actions for converting chapters to books, and books to shelves as per #1087. ### Considerations - When a book is converted to a shelf, The book will remain if it contains any direct child pages but will have ` Pages` appended to the name and this book will be added to the new "Converted" shelf. - These changes additionally bring in availability to set/update book/shelf cover images via the API. ### TODO These are in-addition to the in-code todos. - [x] Move added text to translations. - [x] Add tests to cover newly available API shelf/book cover image params. - [x] We should show a warning in regards to the difference in permissions for shelves when promoting a book. - [x] We should shown a warning about handling direct pages when promoting a book. - [x] Test setting book cover image from API - [x] Ensure we can update without resetting image accidentally - [x] Ensure api docs correct. - [x] As all above but for shelves. - [x] Add tests to cover each require route permission. --- <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:26:55 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6211