I can delete user stories and tasks, no problem, but I can't figure out how to delete a comment from the discussion in a VSTS user story.
You can't. The work item history is immutable.
No, it is not possible to delete a comment. However, you can always post a second comment saying not to read the first one and highlight the second comment in red. This will lead to all users ignoring the original comment as if it were deleted.
Edit: It is now possible to delete and edit comments. Edits and deletions may or may not appear in the history. Still, my original answer was a good workaround for the time.
If you are brave and have access to the underlying database, here is how I "removed" a discussion item from a TFS 2017 User Story. I didn't really remove the discussion item itself, I just replaced the actual words users will see from the original words posted to something else. I also don't know if this table is still the same format in later versions of TFS.
Let's say it is the user story (or task, or whatever) with ID of 4004. The ID column of the [WorkItemLongTexts] table below is indexed and matches on the ID of the item being discussed. Here is a query for all the WorkItemLongTexts rows related to this item ID. Here I even narrowed it down further looking for just the row with some of the offensive text you want to find and eliminate using the LIKE clause on the [Words] column:
SELECT TOP (1000) *
FROM [dbo].[WorkItemLongTexts]
WHERE ID = 4004 AND [Words] LIKE '%<stuff you dont like>%'
ORDER BY [AddedDate] DESC
Note that the columns you care most about in this table are [Words] (this is the comment) and [AddedDate] which I use as the index of the row you want to 'fix'.
I then updated the offensive text to something new in this row as follows, pasting the AddedDate of the row you want to fix from your query above into the WHERE clause. The AddedDate should be unique, you can verify with a SELECT on AddedDate with that datetime first to guarantee you will only be changing one row. Here is a sample UPDATE:
UPDATE [dbo].[WorkItemLongTexts] SET [Words] = '-- removed comment --'
where [AddedDate] = '2021-05-28 16:59:37.367'
I offer no guarantee that there will be no side effects of doing this. I don't think there would be, I've not experienced any. I've successfully done this twice in the past 4 years with no issue... We host this TFS database locally still, so the database is available for me to manually update this way.
© 2022 - 2024 — McMap. All rights reserved.