[RFC|Accepted] Soft Delete

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.1/Ascraeus branch. Everything listed in this forum will be available in phpBB 3.1.
Post Reply
User avatar
Pony99CA
Registered User
Posts: 986
Joined: Sun Feb 08, 2009 2:35 am
Location: Hollister, CA
Contact:

Re: [RFC|Accepted] Soft Delete

Post by Pony99CA »

nickvergessen wrote:
Pony99CA wrote:If you do it the other way, what happens when the unapproved post gets approved? Does that author suddenly become the topic starter? If not, then the topic starter would appear to be somebody other than the person who wrote the first post, which will confuse users.
Yes, that does happen. Topic starter is always the first approved post. The question now is, who should be the topic starter, when the approved posts are gone?
I tried to answer that -- whoever has the first remaining (non-deleted) post. If that post is unapproved, then the topic is unapproved, too. (But what happens to users' post counts?)

If you don't want topics to go unapproved like that, you could make the rule that the topic starter is the author of the first approved, visible post. (Of course, if there is no first approved, visible post -- just unapproved and soft deleted posts -- you'll probably have to make it the author of the first post, period.)

Either way, you're going to have a problem if the soft deleted post at the beginning of a topic is restored, because that will change the topic starter, but I guess it's the analog of the topic starter changing if a post is deleted (or soft deleted).
nickvergessen wrote:Btw current implementation is no help there, as it has a bug. you will have an approved topic that does not contain any posts for normal users. (which should than not show up...)
The current 3.1 implementation? Because I don't know of a way to make that happen in 3.0 (short of changing the post approval status in the database, which does illustrate that behavior).

Personally, I would separate this into two features -- "soft delete" for end users and and "unapproval" for moderators. Unapproving a post would requre the same permission as approving a post (so no new permissions would be needed). Soft delete for users would require the edit post permission (because they aren't hard deleting the post, just "changing" it) and the user would also be able to see, edit, restore and hard delete his own soft deleted posts (moderators would also be able to see, edit and hard delete them, plus unapprove or restore them).

This doesn't resolve the concerns over topic starter and post counts, but it does provide a nice separation of the moderator and user capabilities. As they're very similar, you can call them both "soft delete", but use different (not new) permissions for them and allow users to see, edit, restore and hard delete posts that they soft deleted themselves.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [RFC|Accepted] Soft Delete

Post by nickvergessen »

Pony99CA wrote:
nickvergessen wrote:Btw current implementation is no help there, as it has a bug. you will have an approved topic that does not contain any posts for normal users. (which should than not show up...)
The current 3.1 implementation? Because I don't know of a way to make that happen in 3.0 (short of changing the post approval status in the database, which does illustrate that behavior).
3.0, it's quite easy, post a normal topic, make an unapproved reply, delete first post, viola

Currently my code behaves like the following:
when a post's visibility is approved, it is added to the topics reply count, forums post count and users post count,
in every other case, it is removed again.

Btw, I also removed the feature for "unapproving". As it has the same effect as soft delete, we can just use that one.
Member of the Development-TeamNo Support via PM

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: [RFC|Accepted] Soft Delete

Post by imkingdavid »

Unless I'm completely missing something, I cannot figure out how to soft delete a topic short of manually changing the visibility directly in the DB.
As you told me on IRC, I can accomplish this by editing the post and checking Soft delete.

Aside from that, there are a couple of issues I noticed while generally messing around with it:
  • In the MCP -> Moderation Queue -> Deleted posts
    • When no posts are deleted, it says "There are no posts waiting for approval."
    • A new nav item comes up under Deleted posts called "Approve details"; if I click it, it complains that "You must select at least one post to perform this action."
  • After I use the MCP to hard delete the last post in a topic, and therefore the topic itself, I get the following SQL error when I return to the MCP forum view:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 = 1 ORDER BY t.topic_type DESC, t.topic_last_post_time DESC LIMIT 25' at line 4 [1064]

    SQL

    SELECT t.topic_id FROM phpbb_topics t WHERE t.forum_id = 2 1 = 1 ORDER BY t.topic_type DESC, t.topic_last_post_time DESC LIMIT 25
    I traced that back to line 160 of mcp_forum.php, which is this query:

    Code: Select all

        $sql = 'SELECT t.topic_id
            FROM ' . TOPICS_TABLE . ' t
            WHERE t.forum_id = ' . $forum_id . '
                ' . phpbb_content_visibility::get_visibility_sql('topic', $forum_id, 't.') . "
                $limit_time_sql
            ORDER BY t.topic_type DESC, $sort_order_sql";
        $result = $db->sql_query_limit($sql, $topics_per_page, $start);] 
I'll post more later as I find it.
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [RFC|Accepted] Soft Delete

Post by nickvergessen »

Why the "Topics waiting for approval" module in MCP does not make much sense anymore...

The problem is, that the module currently is used for the following case:
  • A topic is newly posted with one unapproved post
However a second case can occure, where a topic has only one unapproved post:
  1. Post a normal topic
  2. Post an unapproved reply
  3. Delete approved first post
The topic is now still approved, but has no posts visible for normal users.
So this behaviour is clearly a bug in Olympus.

Basically a unapproved topic can have multiple unapproved posts.
You just need to repeat step 2 as often as you like.

The current approving, just determinates whether a post is the first post,
and in case it is, the topic is approved aswell, keeping the logical problem from above.

So what should "Topics waiting for approval" be? Just topics with 1 unapproved post?
Or all topics that have only unapproved posts? And what should happen, when you approve them?
Should just the first post be approved, or all posts?
Member of the Development-TeamNo Support via PM

User avatar
Pony99CA
Registered User
Posts: 986
Joined: Sun Feb 08, 2009 2:35 am
Location: Hollister, CA
Contact:

Re: [RFC|Accepted] Soft Delete

Post by Pony99CA »

First, is soft deletion piggybacking on post approval? If not, you'll have the same problem if step #2 above is replaced with "Post an approved reply and soft delete it", won't you? I'm going to assume that they are not the same for now.

Second, clearly a topic with no posts visible to a user (the user can't see unapproved and/or soft deleted posts) should not be shown to that user. So the correct behavior seems to be, when the last visible post is deleted (or soft deleted), changing the topic status to unapproved or soft deleted (depending on the status of the first post in the topic). Perhaps a warning should be given in that case ("Warning: This topic will have no more visible posts and will only be visible to moderators. Do you want to continue?").

Third, approving or undeleting ANY post in that topic will make that topic visible again regardless of which post it is (but see below, where that may not be possible without approving the topic).

Finally, perhaps "Topics waiting for approval" should be renamed to "Topics not visible to users". If the moderator marks that topic and wants to make it visible (approve or undelete it), he could be offered options (only the first post, all unapproved posts, all soft deleted posts, all posts).

However, the module still seems to be necessary. Posts in unapproved topics don't seem to be displayed in the Posts awaiting approval module, so either you'd need to change that or keep the topic module.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [RFC|Accepted] Soft Delete

Post by nickvergessen »

Pony99CA wrote:First, is soft deletion piggybacking on post approval? If not, you'll have the same problem if step #2 above is replaced with "Post an approved reply and soft delete it", won't you? I'm going to assume that they are not the same for now.
Well there are two cases of soft delete. The one from above has mostly the same problem, but as topics can be soft deleted completly the module makes sense for that.
Pony99CA wrote:Second, clearly a topic with no posts visible to a user (the user can't see unapproved and/or soft deleted posts) should not be shown to that user. So the correct behavior seems to be, when the last visible post is deleted (or soft deleted), changing the topic status to unapproved or soft deleted (depending on the status of the first post in the topic). Perhaps a warning should be given in that case ("Warning: This topic will have no more visible posts and will only be visible to moderators. Do you want to continue?").
Well the post could also be deleted by a user, so we can not leak that information.

Another idea that just poped in my mind. Maybe there should be two types for both:
  • Soft deleted topic: A moderator manually soft deleted the topic through the "Quick Moderation", these topics could be displayed in "Deleted topics" module
  • Passively soft deleted topic: Steps from above, these posts would only be displayed in "Deleted posts" module, the topic would NOT be displayed in "Deleted topics"
  • Unapproved topics: Topics that were created through 1 unapproved post, these topics would be displayed in "Topics waiting for approval"
  • Passively unapproved topics: Steps from above, topics that do only contain unapproved posts. The posts are in "Posts waiting for approval", while the topic is NOT in "Topics waiting for approval"
Does that sound logical to you?
Member of the Development-TeamNo Support via PM

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] Soft Delete

Post by Oleg »

For efficiency reasons the topic should probably be un-approved when its post content changes such that the topic has no approved (and thus visible) posts.

Also, to clarify, approval and deletion should be separate concepts, and distinguishable by both users and moderators. I am not sure what "un-approving" a specific post means conceptually.

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [RFC|Accepted] Soft Delete

Post by nickvergessen »

Oleg wrote:Also, to clarify, approval and deletion should be separate concepts
Well they just act the same way.
Oleg wrote:I am not sure what "un-approving" a specific post means conceptually.
well this is not possible, but it would be changing *_visibility to ITEM_UNAPPROVED from either ITEM_APPROVED or ITEM_DELETED
Member of the Development-TeamNo Support via PM

User avatar
Pony99CA
Registered User
Posts: 986
Joined: Sun Feb 08, 2009 2:35 am
Location: Hollister, CA
Contact:

Re: [RFC|Accepted] Soft Delete

Post by Pony99CA »

nickvergessen wrote:
Pony99CA wrote:Second, clearly a topic with no posts visible to a user (the user can't see unapproved and/or soft deleted posts) should not be shown to that user. So the correct behavior seems to be, when the last visible post is deleted (or soft deleted), changing the topic status to unapproved or soft deleted (depending on the status of the first post in the topic). Perhaps a warning should be given in that case ("Warning: This topic will have no more visible posts and will only be visible to moderators. Do you want to continue?").
Well the post could also be deleted by a user, so we can not leak that information.
I'm not sure what information is really being "leaked". The user only sees his post, so soft deleting it is just telling him that the topic will still exist but nobody will be able to see it.
nickvergessen wrote:Another idea that just poped in my mind. Maybe there should be two types for both:
  • Soft deleted topic: A moderator manually soft deleted the topic through the "Quick Moderation", these topics could be displayed in "Deleted topics" module
  • Passively soft deleted topic: Steps from above, these posts would only be displayed in "Deleted posts" module, the topic would NOT be displayed in "Deleted topics"
  • Unapproved topics: Topics that were created through 1 unapproved post, these topics would be displayed in "Topics waiting for approval"
  • Passively unapproved topics: Steps from above, topics that do only contain unapproved posts. The posts are in "Posts waiting for approval", while the topic is NOT in "Topics waiting for approval"
Does that sound logical to you?
I suppose that makes some sense. I still think that the warning about "passively" deleting a topic is useful.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

User avatar
Pony99CA
Registered User
Posts: 986
Joined: Sun Feb 08, 2009 2:35 am
Location: Hollister, CA
Contact:

Re: [RFC|Accepted] Soft Delete

Post by Pony99CA »

nickvergessen wrote:
Oleg wrote:Also, to clarify, approval and deletion should be separate concepts
Well they just act the same way.
Not quite. Approval (and "unapproval" if that exists) are purely Moderator permissions. Soft deletion is both a User permission (for the user's own posts) and a Moderator permission. The effect will appear the same to most users, but not to Moderators.
nickvergessen wrote:
Oleg wrote:I am not sure what "un-approving" a specific post means conceptually.
well this is not possible, but it would be changing *_visibility to ITEM_UNAPPROVED from either ITEM_APPROVED or ITEM_DELETED
Correct, but, in addition the difference above, there's also a difference of intent. Unapproving a post or topic implies that a Moderator wants to discuss it with other Moderators; soft deleting a post or topic implies that a Moderator (or User) wants to remove it completely (but they may not have permission for hard deleting, which an Admin may reserve for himself).

If we don't have unapproval, soft delete will end up serving both purposes, thus blurring the line betwen post approval and restoring a soft deleted post. The more that I think about this, the more I believe that soft deletion should only be a User permission (and the user could see and restore his soft deleted posts) while unapproval would be a Moderator permission that put posts back in the moderation queue. In other words, Moderators would either unapprove a post that required discussion or hard delete a post that was clearly inappropriate (spam, for example). You could have soft deletion for Moderators, too, but I'm not sure that's as useful as unapproval and it may confuse moderators more (as they have very similar effects).

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

Post Reply