There's currently no visibility to deletion activity outside of the DB. #941

Closed
opened 2026-02-04 23:05:32 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @ezzra on GitHub (Dec 9, 2018).

If a page is deleted, no entry is added to the activity table but I think its also very much worth to mention this.

Originally created by @ezzra on GitHub (Dec 9, 2018). If a page is deleted, no entry is added to the activity table but I think its also very much worth to mention this.
OVERLORD added the 🔨 Feature Request🏭 Back-End labels 2026-02-04 23:05:32 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Dec 10, 2018):

Hi @ezzra,
Just tested this in my dev instance, Seemed to log a page_delete activity as expected. Such activity won't be logged if the page delete is performed by a book delete, since activity reflects user-actions.

image

If they still don't show for you please confirm the exact steps you're performing and I'll try to re-produce.

@ssddanbrown commented on GitHub (Dec 10, 2018): Hi @ezzra, Just tested this in my dev instance, Seemed to log a `page_delete` activity as expected. Such activity won't be logged if the page delete is performed by a book delete, since activity reflects user-actions. ![image](https://user-images.githubusercontent.com/8343178/49703473-80bd7e00-fbfd-11e8-9ba7-ec793cd3669c.png) If they still don't show for you please confirm the exact steps you're performing and I'll try to re-produce.
Author
Owner

@ezzra commented on GitHub (Dec 10, 2018):

oops yes did not check this well enough, its actually in the DB tables but still does not show up in the web frontend. I guess that is because of the missing entity_id after the deletion. That is why also all page_create and page_update for this page vanish after deleting. Did not really test this because of time now, but its just looks like.

@ezzra commented on GitHub (Dec 10, 2018): oops yes did not check this well enough, its actually in the DB tables but still does not show up in the web frontend. I guess that is because of the missing `entity_id` after the deletion. That is why also all page_create and page_update for this page vanish after deleting. Did not really test this because of time now, but its just looks like.
Author
Owner

@ezzra commented on GitHub (Dec 10, 2018):

Ok I looked it up, it's because of the permissions, obviously the query can't check if a missing object has the necessary permissions, so this will not return the activities of deleted objects:

SELECT *
FROM `activities`
WHERE `book_id` = '1'
  AND (EXISTS
         (SELECT `id`
          FROM `joint_permissions`
          WHERE joint_permissions.entity_id=activities.entity_id
            AND joint_permissions.entity_type=activities.entity_type
            AND `action` = 'view'
            AND `role_id` IN ('1')
            AND (`has_permission` = '1'
                 OR (`has_permission_own` = '1'
                     AND `created_by` = '1'))))
ORDER BY `created_at` DESC
LIMIT 20
OFFSET 0

I'm afraid to fix that, one would have to change the delete process from real cascade deleting to updating the page with a "deleted=true" column.

@ezzra commented on GitHub (Dec 10, 2018): Ok I looked it up, it's because of the permissions, obviously the query can't check if a missing object has the necessary permissions, so this will not return the activities of deleted objects: ``` SELECT * FROM `activities` WHERE `book_id` = '1' AND (EXISTS (SELECT `id` FROM `joint_permissions` WHERE joint_permissions.entity_id=activities.entity_id AND joint_permissions.entity_type=activities.entity_type AND `action` = 'view' AND `role_id` IN ('1') AND (`has_permission` = '1' OR (`has_permission_own` = '1' AND `created_by` = '1')))) ORDER BY `created_at` DESC LIMIT 20 OFFSET 0 ``` I'm afraid to fix that, one would have to change the delete process from real cascade deleting to updating the page with a "deleted=true" column.
Author
Owner

@ssddanbrown commented on GitHub (Dec 10, 2018):

Yeah, This is kind of by design.

At some point it'd be nice to have a admin-area activity log 'Audit' view where they can see all activities otherwise they'd need to resort to the DB for now.

Otherwise we'd be looking to implement #1017 functionality to get to soft-deletes to keep related data, But you'd still have the same issues on permanent delete.

@ssddanbrown commented on GitHub (Dec 10, 2018): Yeah, This is kind of by design. At some point it'd be nice to have a admin-area activity log 'Audit' view where they can see all activities otherwise they'd need to resort to the DB for now. Otherwise we'd be looking to implement #1017 functionality to get to soft-deletes to keep related data, But you'd still have the same issues on permanent delete.
Author
Owner

@ezzra commented on GitHub (Dec 10, 2018):

Otherwise we'd be looking to implement #1017

ah ok good to see that there already is an issue for that, I just wanted to propose that :)

But you'd still have the same issues on permanent delete.

yes true, but this might also be intended when using a permanent delete and there could be a warning/information about that. There could also be implemented a possibility to just remove the content but to keep the metadata. But I guess #1017 is the first and important step

@ezzra commented on GitHub (Dec 10, 2018): > Otherwise we'd be looking to implement #1017 ah ok good to see that there already is an issue for that, I just wanted to propose that :) > But you'd still have the same issues on permanent delete. yes true, but this might also be intended when using a permanent delete and there could be a warning/information about that. There could also be implemented a possibility to just remove the content but to keep the metadata. But I guess #1017 is the first and important step
Author
Owner

@ssddanbrown commented on GitHub (Sep 19, 2020):

As of v0.30, There will be an audit log interface included where delete events will be made visible without needing to access the database:

image

Therefore this specific request should be covered.
Thanks again @ezzra for the request.

@ssddanbrown commented on GitHub (Sep 19, 2020): As of v0.30, There will be an audit log interface included where delete events will be made visible without needing to access the database: ![image](https://user-images.githubusercontent.com/8343178/93666514-ab956100-fa76-11ea-8108-6aaf1cdc9fe0.png) Therefore this specific request should be covered. Thanks again @ezzra for the request.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#941