Current time: 05-24-2012, 01:42 PM Hello There, Guest! (LoginRegister)


 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Merge posts - attachment(s) problem [R] [C-Michael83]
10-30-2008, 07:04 PM
Post: #1
[F] Merge posts - attachment(s) problem [R] [C-Michael83]
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]
Visit this user's website Find all posts by this user
10-30-2008, 08:06 PM
Post: #2
RE: Merge posts - attachment(s) problem [R]
Hmm, shouldn't the attachmentcount be incremented to 1 when you attach the attachment to your first post then?
Visit this user's website Find all posts by this user
10-30-2008, 10:17 PM (This post was last modified: 10-30-2008 10:18 PM by Michael S..)
Post: #3
RE: Merge posts - attachment(s) problem [R]
It's 1 before the merge. The reason for the change can be found in the function merge_posts():
PHP Code:
$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]
Visit this user's website Find all posts by this user
10-30-2008, 10:22 PM
Post: #4
RE: Merge posts - attachment(s) problem [R]
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
Visit this user's website Find all posts by this user
10-30-2008, 10:57 PM
Post: #5
RE: Merge posts - attachment(s) problem [R]
Does this work? In inc/class_moderation.php find:

PHP Code:
$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

PHP Code:
$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
Visit this user's website Find all posts by this user
10-30-2008, 11:22 PM
Post: #6
RE: Merge posts - attachment(s) problem [R]
I tested several cases and I could not find any problem. The fix is working fine.

Greets,
Michael
-------------
[Image: donation_drive_sig.png]
Visit this user's website Find all posts by this user
10-30-2008, 11:56 PM
Post: #7
[F] Merge posts - attachment(s) problem [R]
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
Visit this user's website Find all posts by this user


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication