netcreateorg / netcreate-itest

Developing the 2.0 version of NetCreate
https://github.com/netcreateorg/netcreate-2018
Other
0 stars 0 forks source link

Prune comments if all have been marked deleted #156

Closed benloh closed 3 months ago

benloh commented 3 months ago

When deleting comments, if all comments in a thread (root + replies) have been marked deleted, delete the whole thread.

Conditions:

Repeat as admin

Repeat over network with a mix of local and network comments.

Bugs:

@jdanish This can be a bit of a hairy test. Be sure to test all combinations: local vs net, admin vs non-admin.

benloh commented 3 months ago

Joshua writes:

Hey @benloh Looking pretty good. However: User A makes a comment (1) User B replies once (2) User B replies again (3)

User B deletes 2, it is flagged as "deleted" (correct) User B then deletes 3 (it disappears, but 2 remains and is flagged deleted). Should disappear? User A deletes 1 and 2 appears to go with it (good)

jdanish commented 3 months ago

Logon as user 1, add comment Logon as user 2, add one Go back to 1, I see 2 comments there. Leave comment window open. Go back to user 2 and delete second comment. Return to user 1 screen, and comment is correct but indicator shows old number (2)

Screenshot 2024-04-02 at 8 09 15 PM

Not a major issue, but in case it ties to something more substantive ...

benloh commented 3 months ago

User B deletes 2, it is flagged as "deleted" (correct) User B then deletes 3 (it disappears, but 2 remains and is flagged deleted). Should disappear? User A deletes 1 and 2 appears to go with it (good)

So basically you want the system to walk backwards up the chain and delete everything until you hit something not deleted? e.g.

A DELETED
   A1 REPLY DELETED
   A2 REPLY DELETED
   A3 REPLY
   A4 REPLY DELETED
   A5 REPLY DELETED
jdanish commented 3 months ago

User B deletes 2, it is flagged as "deleted" (correct) User B then deletes 3 (it disappears, but 2 remains and is flagged deleted). Should disappear? User A deletes 1 and 2 appears to go with it (good)

So basically you want the system to walk backwards up the chain and delete everything until you hit something not deleted? e.g.

A DELETED
   A1 REPLY DELETED
   A2 REPLY DELETED
   A3 REPLY
   A4 REPLY DELETED
   A5 REPLY DELETED
  • If you delete A2, A1 would also be deleted, but A3 would remain
    • If you delete A5, A4 would also be deleted, but NOT A1 and A2

I was thinking more - if nothing below you is valid (never deleted) then when you are deleted you don't need to be there anymore. And work your way up.

So if A4 was deleted, as soon as you deleted A5, both A4 and A5 would disappear, but A3 stays. If A3 is deleted, A1 and A2 go away. Unless you go to admin of course and kill the whole thing.

EDIT: And yes, if A1 disappears (because the rest below it is gone), then A would go away.

benloh commented 3 months ago

I think we're saying the same thing, but I'm not 100% sure...
Assuming the same scenario where A3 is the only undeleted comment, and assuming that these are unique actions, not taken together, with an additional clarification:

A DELETED
   A1 REPLY DELETED
   A2 REPLY DELETED
   A3 REPLY OK
   A4 REPLY DELETED
   A5 REPLY DELETED
B DELETED
  B1 REPLY DELETED
  B2 REPLY OK
jdanish commented 3 months ago

I think so, but 2 things aren't quite sitting right for me ... so, I'll try with this. First, let me verify that your diagram means something like these attachments.

You start with this:

Screenshot 2024-04-03 at 1 52 07 AM

And eventually have this:

Screenshot 2024-04-03 at 1 52 46 AM

You said:

If you ONLY delete A1, A2 is deleted. A3 would remain, and A would remain even though it's been deleted because A3 is still there.

I think first of all, A1 and A2 were already deleted, but either way because A3 is below, they remain visible so long as A3 is there.

Also, The state of A4 and A5 is impossible, no?

Assuming you had:

... A3 REPLY OK A4 REPLY OK A5 REPLY OK

If you delete A5 first, it goes away because it is the bottom (last reply) If you delete A4 first then it remains because of A5, but if you also delete A5, A4 and A5 go away because they are now both at the bottom, though A3 remains.

That's what I meant by: if you are deleted and there are no-longer undeleted nodes beneath you, you go away. In the prior case of A1 and A2, they both stay until A3 is deleted because they provide the context for A3.

If we are still talking past each other let's hop on zoom for 5 minutes?

benloh commented 3 months ago

Hah, I think we're on the same page. You're right it was impossible for A4 and A5 to be marked deleted without having them removed. I was ending up with impossible combinations during my QA because things were broken.

jdanish commented 3 months ago

Cool.

benloh commented 3 months ago

@jdanish One more try. I think I have it now? I realized part of the confusion was I wasn't first defining what the previous state was because there are too many combinations.

jdanish commented 3 months ago

Seems to work for me!