Is there a way to delete a comment from a user story in VSTS?
Asked Answered
K

3

16

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.

Koopman answered 7/9, 2016 at 14:8 Comment(4)
D'oh :o !! It's not even editable. Is MS even using their own product ?Whall
In 2018 AUG, it is still not removable or editable.It is a pain now.Sheepfold
Now it's possible!Planometer
It's possible if you are hosting in such a way you can edit the database manually, and you reverse engineer it a little. See my answer below for how I removed an offending discussion item's text in TFS 2017 by manually updating a row in the TFS_DefaultCollection database's dbo.WorkItemLongTexts table.Chalmers
C
15

You can't. The work item history is immutable.

Chlorophyll answered 7/9, 2016 at 14:56 Comment(4)
This doesn't make much sense to me. Everybody makes mistakes, typos, etc. There's no way to correct anything. If this was a design decision it seems like a poor one to me. Everything else I can think of in a user story is mutable.Koopman
It's not deleting but here is the UserVoice link to vote for editing a comment: visualstudio.uservoice.com/forums/…Oklahoma
For whatever it is worth, this is now officially planned in the dev pipeline for Azure DevOps (formerly VSTS). Source: visualstudio.uservoice.com/forums/…Delanos
i see the reason to keep it immutable. but we had someone save a password in the pbi. now it exists forever in the history. wish there was a way to delete it.Infrangible
A
3

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.

Alodee answered 5/1, 2019 at 1:24 Comment(1)
that's so funnyPlanometer
C
0

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.

Chalmers answered 28/5, 2021 at 19:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.