View Issue Details

IDProjectCategoryView StatusLast Update
0026489mantisbtattachmentspublic2020-01-01 14:18
Reportersadovsf Assigned Todregad  
PrioritynormalSeverityminorReproducibilitysometimes
Status closedResolutionduplicate 
Product Version2.22.1 
Summary0026489: Note gets separated from attachments
Description

Sometimes note can be separated from attachment posted in a same time resulting in seemingly multiple notes in issue. Based on going through code i have found a problem that is cause it.

In class IssueNoteAddCommand that is used for adding note with attachments first step is attaching files. Unfortunately each of them gets its own date_added based on db_time call. After that note itself is added with it's own db_time again. When file move is slow so db_time changes in a mean time it will result in file(-s) being before note. That in change results in failed rejoin of them in function bug_activity_combine where only attachments gets merged with notes. Remember files were first and so they are even here and are never merged with note although they were send in a same time by same operation (same issue is in REST api, standard UI and maybe more places).

Simple fix would be to expand t_payload that goes into IssueNoteAddCommand with date_submitted parameter set to db_now. This way note and all its attachments will get same timestamp and will be later properly joined by bug_activity_combine.

Additional Information

It basically requires few lines of code to fix:

IssueNoteAddCommand.php:

$this->date_submitted = $this->payload( 'date_submitted', db_now() );

into validate function along with variable into class itself:

/**
 * Timestamp when note was submited (defaults to db_now())
 */
private $date_submitted = 0;

Then little change in process function (sending this new variable into file_attach_files and bugnote_add)

file_api.php:
Add new optional parameter to file_attach_files

$p_date_submitted 

$c_date_submitted = $p_date_submitted <= 0 ? db_now() : (int)$p_date_submitted;

And lastly send this new param into file_add call inside.

This should be enough to fix this and even allow forcing custom submission date for notes in REST which can be useful when working on tool that has local preview and you need to create notes semengly in history (push then in different time that they are created on php side)

TagsNo tags attached.

Relationships

duplicate of 0024113 closedvboctor Attaching files to a note creates a second note with only the attachments 
related to 0021733 closedvboctor Attachments should be linkable to notes in db 

Activities

dregad

dregad

2019-12-20 11:39

developer   ~0063324

Until 2.21.1 included, attachments were related to bugnotes, based on timestamp. Starting with 2.23.0, they are linked to the bugnote_id. This effectively fixes the issue you're reporting, which I believe is a duplicate of 0024113.

Please upgrade to the latest release.

Issue History

Date Modified Username Field Change
2019-12-20 09:02 sadovsf New Issue
2019-12-20 11:39 dregad Assigned To => dregad
2019-12-20 11:39 dregad Status new => resolved
2019-12-20 11:39 dregad Resolution open => duplicate
2019-12-20 11:39 dregad Note Added: 0063324
2019-12-20 11:39 dregad Relationship added duplicate of 0024113
2019-12-20 11:39 dregad Relationship added related to 0021733
2020-01-01 14:18 atrol Status resolved => closed