Skip to content

Commit

Permalink
Big Reshare insight: display post text that was reshared, closes #1478
Browse files Browse the repository at this point in the history
  • Loading branch information
ginatrapani committed Feb 18, 2013
1 parent 428e7fc commit 59e01b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions webapp/plugins/insightsgenerator/insights/bigreshare.php
Expand Up @@ -65,6 +65,10 @@ public function generateInsight(Instance $instance, $last_week_of_posts, $number
"$this->username's post</a>.";
}
}
//Replace each big resharer's bio line with the text of the post
foreach ($big_reshares as $sharer) {
$sharer->description = '"'.$post->post_text.'"';
}
$simplified_post_date = date('Y-m-d', strtotime($post->pub_date));
$this->insight_dao->insertInsight("big_reshare_".$post->id, $instance->id,
$simplified_post_date, "Big reshare!", $notification_text, basename(__FILE__, ".php"),
Expand Down
Expand Up @@ -142,6 +142,9 @@ public function testMultipleBigReshare() {
$this->assertEqual($result->prefix, 'Big reshare!');
$this->assertEqual($result->filename, 'bigreshare');
$this->assertPattern('/People with lots of followers retweeted/', $result->text);
$sharers = unserialize($result->related_data);
$this->assertEqual($sharers[0]->description,
'"Be liberal in what you accept and conservative in what you send"');
}

public function testSingleBigReshareWithLessThan2xFollowers() {
Expand Down Expand Up @@ -186,6 +189,9 @@ public function testSingleBigReshareWithLessThan2xFollowers() {
$this->assertEqual($result->prefix, 'Big reshare!');
$this->assertEqual($result->filename, 'bigreshare');
$this->assertPattern('/Someone with lots of followers retweeted/', $result->text);
$sharers = unserialize($result->related_data);
$this->assertEqual($sharers[0]->description,
'"Be liberal in what you accept and conservative in what you send"');
}

private function buildData() {
Expand Down

0 comments on commit 59e01b3

Please sign in to comment.