Pasted attachments in comments in the new issue view don't appear as attachments in the history

Description

Summary

When pasting attachments in a comment, history is not updated unlike when adding an attachment to a page:

Background

  • Issue raised by K15T:

Our sync mechanism relies on the issue history to identify what needs to be synced - and now we discovered a problem.

In the OLD issue view, this is the current behavior:

If someone adds an attachment to an issue, it is shown in the UI and REST API as attachment and also the change is in the issue history.

If someone adds an an attachment inside a comment, the attachment is shown in the UI and REST API as attachment and also the change is in the history.

In the NEW issue view, this is the behavior we observed:

If someone adds an attachment to an issue, it is shown in the UI and REST API as attachment and also the change is in the history

If someone adds an an attachment inside a comment, the attachment is NOT shown in the UI, but in the REST API as attachment. NO change is in the history.

Is this an intended behavior - or rather a bug? We'd appreciate it if the new view, also always contains the adding of the attachment in the history.

Notes

  • Discussion with New Issue View team added as an internal comment

Environment

None

Activity

Show:
Matthias Gaiser [K15t]
April 27, 2020, 8:48 AM

I appreciate your reply, Tara. Is there something else we can rely on for now? How are you making that decision in the new issue view whether the attachment is on the comment/issue level?

Tara Tjandra
April 27, 2020, 11:49 PM

Just to clarify my understanding, you want a way to fetch all the attachments for an issue, being able to differentiate whether they are on the comment or at the issue level?

Something I do not recommend but if you’re totally blocked is to bulk fetch the content of comments on an issue using the REST API /rest/api/3/issue/{issueIdOrKey}/comment. From there, you can traverse the returned ADF (Atlassian Document Format) JSON to find the media IDs, and then will need some more black magic to figure out the attachments from there. I believe JSD is doing something along those lines so you can maybe reach out to someone from there to see if there’s anything you can leverage.

The reason I don’t recommend is cause:

  1. Hacky

  2. Complicated

  3. We highly recommend against traversing the ADF structure as we’re moving this domain logic out of Jira.

To do this properly is requiring about 8 weeks of dev work to create an association between attachments and its corresponding field in our database. We then need to populate this for new attachments and backfill all existing attachments.

From there, our new /attachments API will have the metadata required to tell you which attachments belongs to which field.

Sebastian Hesse (K15t)
April 28, 2020, 7:22 AM
Edited

Hi Tara, I'll reply to you since Matthias is not in the office today.

Thanks for your alternative approach. This approach is a way we do not want to go due to the reasons you've mentioned. But if there is no other way, we might take it. That's the reason we've reached out to you: we want to find another way than this one.

Let me quickly describe the problem again, that might make it more clear what we actually want. Citing from the issue description again:

_In the NEW issue view, this is the behavior we observed:
If someone adds an attachment to an issue, it is shown in the UI and REST API as attachment and also the change is in the history
If someone adds an an attachment inside a comment, the attachment is NOT shown in the UI [as an attachment], but in the REST API as attachment. NO change is in the history._

Users can configure two features in a Backbone issue synchronization: they can synchronize comments of an issue and they can synchronize issue attachments. Now the problem is that neither the comment synchronization feature is recognizing these attachments uploaded by the new UI in a comment because we do not scan comments for a reference to attachments (as you mentioned this is hacky and we believe this as well) nor the attachment synchronization feature is recognizing these attachments because nothing is written into the issue history/changelog. (We rely on the issue history to determine which data has changed and therefore which data we have to synchronize)

I hope this makes it more clear what the actual problem is. Having metadata in the /attachment API would help us to identify if an attachment was uploaded within a comment, thanks for mentioning it.

Let's move to potential solutions.

In order to solve the problem of not having the attachments uploaded in the new UI in the issue history, we could look at all attachments and filter out the ones that have been added recently. This is definitely not so nice because it duplicates some work. It's also only a workaround for us but if this is the only option, then we have no other choice... Therefore we've asked if you could at least write the changes into the history, so that our attachment synchronization feature is recognizing the new attachment -> this would be the state as it was with the old UI.

If it's not possible to add this change to the issue history, then we also need to identify if an attachment has been uploaded by a comment or not (as you've suggested or by using the /attachment metadata as soon as they are available). Since we don't want to do this of course, Matthias asked you how you determine if an attachment is a regular issue attachment or comment attachment in the UI. Could you please explain this to us? This might already help us and we could use the same approach if you're using publicly available data.

I appreciate that you took the time to read till the end of this longish comment but I had the feeling a few point's weren't really clear.

Sebastian Hesse (K15t)
May 22, 2020, 12:06 PM

Hello,

it's already been a three weeks again. Is there any update from your side? Especially regarding my comment above. Does it need any further explanation or do you need anything else from our side?

Cheers,
Sebastian

Manuel Jesús Morión Barea
July 9, 2020, 6:24 AM

Hi,

Any news about fixing this Jira Cloud bug?

Assignee

Matthew Canham

Reporter

Anne Calantog

Labels

Components

Configure