View Issue Details

IDProjectCategoryView StatusLast Update
2863Composrchatpublic2016-10-11 02:23
ReporterPDStig Assigned ToChris Graham  
PrioritynormalSeverityminor 
Status resolvedResolutionfixed 
Summary2863: 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.
Attach Tags
Time estimation (hours)
Sponsorship open

Sponsor

Date Added Member Amount Sponsored

Activities

PDStig

2016-10-08 04:57

administrator   ~4384

Last edited: 2016-10-08 05:09

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.

PDStig

2016-10-08 05:26

administrator   ~4385

Last edited: 2016-10-08 05:27

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.

PDStig

2016-10-08 05:32

administrator   ~4386

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   ~4406

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   ~4409

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 PDStig New Issue
2016-10-08 04:57 PDStig Note Added: 0004384
2016-10-08 04:58 PDStig Note Edited: 0004384
2016-10-08 05:09 PDStig Note Edited: 0004384
2016-10-08 05:26 PDStig Note Added: 0004385
2016-10-08 05:27 PDStig Note Edited: 0004385
2016-10-08 05:32 PDStig Note Added: 0004386
2016-10-11 01:21 Chris Graham Note Added: 0004406
2016-10-11 01:21 Chris Graham Status Not 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