View Issue Details

IDProjectCategoryView StatusLast Update
0002863Composrchatpublic2016-10-11 02:23
ReporterPatrick SchmalstigAssigned ToChris Graham 
SeverityMinor-bug 
Status resolvedResolutionfixed 
Product Version 
Fixed in Version 
Summary0002863: Chat archive PT posts count towards points
DescriptionWhen sending chat messages, they create a post in the archives in private topics. Because private topic posts count towards points, that means so do chat archive posts. This means instead of users getting points for chat message, they're getting points for chat message AND a post.
TagsNo tags attached.
Time estimation (hours)
Sponsorship open

Activities

Patrick Schmalstig

2016-10-08 04:57

administrator   ~0004384

Last edited: 2016-10-08 05:09

View 3 revisions

cns_make_post($topic_id, $is_starter ? do_lang('INSTANT_MESSAGING_CONVO') : '', $message, 0, $is_starter, 1, 0, null, null, null, get_member(), null, null, null, false, true, null, false, '', 0, null, false, true);

Found in sources/chat.php line 957.

POSSIBLE Fix (untested):
cns_make_post($topic_id, $is_starter ? do_lang('INSTANT_MESSAGING_CONVO') : '', $message, 0, $is_starter, 1, 0, null, null, null, get_member(), $members[0] === get_member() ? $members[1] : $members[0], null, null, false, true, null, false, '', 0, null, false, true);

What this does is set an intended_solely_for value to the ID of the user the message is being sent to, which is not counted towards post points when set.

___

EDIT: I was wrong. This does NOT work.

Patrick Schmalstig

2016-10-08 05:26

administrator   ~0004385

Last edited: 2016-10-08 05:27

View 2 revisions

Better fix, though not entirely practical:

in the cns_force_update_member_post_count function of sources/cns_posts_action.php, find:

$map = array('p_poster' => $member_id, 'p_cache_forum_id' => null);
        if (addon_installed('unvalidated')) {
            $map['p_validated'] = 1;
        }
        $member_post_count += $GLOBALS['FORUM_DB']->query_select_value('f_posts', 'COUNT(*)', $map);

Comment out:
        $member_post_count += $GLOBALS['FORUM_DB']->query_select_value('f_posts', 'COUNT(*)', $map);

This will cause caching to not count private topic posts towards a member's post count. That's the unfortunate consequence of this fudge, but at least it stops counting private topic posts towards points, especially when it comes to chat archive posts.

Patrick Schmalstig

2016-10-08 05:32

administrator   ~0004386

I noticed wherever in the Composr code exists a cns_force_update_member_post_count call with the second parameter specified ($member_post_count_dif), it is always within the condition that a forum ID exists. So it looks like the intention was not for private topic posts to count. However, cache counts them.

I could be wrong though.

Chris Graham

2016-10-11 01:21

administrator   ~0004406

I tracked the code, and tested carefully, and I think the base assumption is wrong - I can't see the problem occurring.

I tested manually making a PT, doing an IM, and in both cases the post count remained the same. The point calculation was correct. I cleared the topic cache and same result.

As your final post pointed out, the post count is only calculated for non-private topics.

Chris Graham

2016-10-11 02:23

administrator   ~0004409

Ok, I stand corrected - I reproduced incorrectly. It was related to the cache rebuild process only though.

Issue History

Date Modified Username Field Change
2016-10-08 04:28 Patrick Schmalstig New Issue
2016-10-08 04:57 Patrick Schmalstig Note Added: 0004384
2016-10-08 04:58 Patrick Schmalstig Note Edited: 0004384 View Revisions
2016-10-08 05:09 Patrick Schmalstig Note Edited: 0004384 View Revisions
2016-10-08 05:26 Patrick Schmalstig Note Added: 0004385
2016-10-08 05:27 Patrick Schmalstig Note Edited: 0004385 View Revisions
2016-10-08 05:32 Patrick Schmalstig Note Added: 0004386
2016-10-11 01:21 Chris Graham Note Added: 0004406
2016-10-11 01:21 Chris Graham Status non-assigned => closed
2016-10-11 01:21 Chris Graham Assigned To => Chris Graham
2016-10-11 01:21 Chris Graham Resolution open => unable to reproduce
2016-10-11 02:23 Chris Graham Note Added: 0004409
2016-10-11 02:23 Chris Graham Status closed => resolved
2016-10-11 02:23 Chris Graham Resolution unable to reproduce => fixed