Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Merge posts - attachment(s) problem [R] [C-Michael83]
#1
If you merge two posts and the first of them contains an attachment is is not shown anymore after the merge. The problem is that the attachmentcount is set to 0 in the threads table.

It's working correctly if the second post contains an attachment.

Steps to reproduce:
1. Create a new thread and attach a file to your post.
2. Create a reply.
3. Merge the two posts.
Greets,
Michael
-------------
[Image: donation_drive_sig.png]
#2
Hmm, shouldn't the attachmentcount be incremented to 1 when you attach the attachment to your first post then?
#3
It's 1 before the merge. The reason for the change can be found in the function merge_posts():
$query2 = $db->simple_select("attachments", "COUNT(aid) as count", "pid IN({$pidin}) AND pid != '{$masterpid}' AND visible='1'");
$attachment_count = $db->fetch_field($query2, "count");

$db->update_query("threads", array("attachmentcount" => $attachment_count), "tid = '{$mastertid}'");
$masterpid is the ID of the first post and because of that the query returns 0.
Greets,
Michael
-------------
[Image: donation_drive_sig.png]
#4
I'll have to look at the logs, but I'm pretty sure that was put in place to fix another bug for some reason
#5
Does this work? In inc/class_moderation.php find:

$query2 = $db->simple_select("attachments", "COUNT(aid) as count", "pid IN({$pidin}) AND pid != '{$masterpid}' AND visible='1'");
$attachment_count = $db->fetch_field($query2, "count");

and replace with

$query2 = $db->simple_select("attachments", "COUNT(aid) as count", "pid IN({$pidin}) AND visible='1'");
$attachment_count = $db->fetch_field($query2, "count");

I don't see why we wouldn't count the first post in the amount of attachments
#6
I tested several cases and I could not find any problem. The fix is working fine.
Greets,
Michael
-------------
[Image: donation_drive_sig.png]
#7
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group


Forum Jump:


Users browsing this thread: 1 Guest(s)