Skip to content

Commit

Permalink
Fix not welcoming users who post two notices quickly
Browse files Browse the repository at this point in the history
  • Loading branch information
RedEnchilada committed Feb 5, 2015
1 parent 77007f0 commit f734a10
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion welcomeponyd.php
Expand Up @@ -142,6 +142,7 @@
while(!System_Daemon::isDying()) {
$posts = getTimeline();
$lastCachedId = $lastNoticeId;
$currentReadIndex = array();
foreach($posts as $post) {
// Store the ID so we don't reparse notices we've already seen
if($post->id > $lastNoticeId)
Expand All @@ -168,8 +169,13 @@
$newUser = true;
}

// Count how many notices from this user we've seen this loop
if(!isset($currentReadIndex[$post->user->id]))
$currentReadIndex[$post->user->id] = 0;
$currentReadIndex[$post->user->id]++;

// Send a welcome if they have only one notice
if($post->user->statuses_count == 1 && $newUser) {
if($post->user->statuses_count == $currentReadIndex[$post->user->id] && $newUser) {
System_Daemon::info('new user found: %s', $post->user->screen_name);
postNotice(getMessage($post->user->screen_name), $post->id);
continue;
Expand Down

0 comments on commit f734a10

Please sign in to comment.