Skip to content

Commit

Permalink
Group attachments into a single entry
Browse files Browse the repository at this point in the history
If user attaches multiple files as part of submitting the issue,
or via the note dropzone without a note, they were not grouped.
Now they are grouped into a single entry similar to attachments
submitted with a note.

Issue #21727
  • Loading branch information
vboctor committed Oct 30, 2016
1 parent add29e7 commit 72c43cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
18 changes: 10 additions & 8 deletions bugnote_view_inc.php
Expand Up @@ -308,14 +308,6 @@

if( isset( $t_activity['attachments'] ) && count( $t_activity['attachments'] ) > 0 ) {
echo '<br /><br />';

if ( !$t_security_token_attachments_delete ) {
$t_security_token_attachments_delete = form_security_token( 'bug_file_delete' );
}

foreach( $t_activity['attachments'] as $t_attachment ) {
print_bug_attachment( $t_attachment, $t_security_token_attachments_delete );
}
}
} else {
if ( !$t_security_token_attachments_delete ) {
Expand All @@ -324,6 +316,16 @@

print_bug_attachment( $t_activity['attachment'], $t_security_token_attachments_delete );
}

if( isset( $t_activity['attachments'] ) && count( $t_activity['attachments'] ) > 0 ) {
if ( !$t_security_token_attachments_delete ) {
$t_security_token_attachments_delete = form_security_token( 'bug_file_delete' );
}

foreach( $t_activity['attachments'] as $t_attachment ) {
print_bug_attachment( $t_attachment, $t_security_token_attachments_delete );
}
}
?>
</td>
</tr>
Expand Down
3 changes: 1 addition & 2 deletions core/bug_activity_api.php
Expand Up @@ -228,11 +228,10 @@ function bug_activity_combine( $p_entries ) {
foreach( $p_entries as $t_activity ) {
if( $t_last_entry != null ) {
if( $t_last_entry['user_id'] == $t_activity['user_id'] &&
$t_last_entry['type'] == ENTRY_TYPE_NOTE &&
$t_activity['type'] == ENTRY_TYPE_ATTACHMENT &&
abs( $t_activity['timestamp'] - $t_last_entry['timestamp'] ) <=
$t_threshold_in_seconds ) {
$t_last_entry['attachments'][] = $t_activity['attachment'];
$t_last_entry['attachments'][] = $t_activity['attachment'];
} else {
$t_combined_entries[] = $t_last_entry;
$t_last_entry = $t_activity;
Expand Down

0 comments on commit 72c43cb

Please sign in to comment.