Skip to content

Commit f734a10

Browse files
author
RedEnchilada
committed
Fix not welcoming users who post two notices quickly
1 parent 77007f0 commit f734a10

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

welcomeponyd.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142
while(!System_Daemon::isDying()) {
143143
$posts = getTimeline();
144144
$lastCachedId = $lastNoticeId;
145+
$currentReadIndex = array();
145146
foreach($posts as $post) {
146147
// Store the ID so we don't reparse notices we've already seen
147148
if($post->id > $lastNoticeId)
@@ -168,8 +169,13 @@
168169
$newUser = true;
169170
}
170171

172+
// Count how many notices from this user we've seen this loop
173+
if(!isset($currentReadIndex[$post->user->id]))
174+
$currentReadIndex[$post->user->id] = 0;
175+
$currentReadIndex[$post->user->id]++;
176+
171177
// Send a welcome if they have only one notice
172-
if($post->user->statuses_count == 1 && $newUser) {
178+
if($post->user->statuses_count == $currentReadIndex[$post->user->id] && $newUser) {
173179
System_Daemon::info('new user found: %s', $post->user->screen_name);
174180
postNotice(getMessage($post->user->screen_name), $post->id);
175181
continue;

0 commit comments

Comments
 (0)