Image to Post - favorites

This commit is contained in:
Matthew Barbour 2020-10-26 10:15:51 -05:00
parent 27b2988bd8
commit 82e88969d6
4 changed files with 11 additions and 11 deletions

View file

@ -13,5 +13,5 @@ class FavoritesInfo extends ExtensionInfo
"Gives users a \"favorite this image\" button that they can press
<p>Favorites for a user can then be retrieved by searching for \"favorited_by=UserName\"
<p>Popular images can be searched for by eg. \"favorites>5\"
<p>Favorite info can be added to an image's filename or tooltip using the \$favorites placeholder";
<p>Favorite info can be added to a post's filename or tooltip using the \$favorites placeholder";
}

View file

@ -75,7 +75,7 @@ class Favorites extends Extension
$i_days_old = ((time() - strtotime($event->display_user->join_date)) / 86400) + 1;
$h_favorites_rate = sprintf("%.1f", ($i_favorites_count / $i_days_old));
$favorites_link = make_link("post/list/favorited_by={$event->display_user->name}/1");
$event->add_stats("<a href='$favorites_link'>Images favorited</a>: $i_favorites_count, $h_favorites_rate per day");
$event->add_stats("<a href='$favorites_link'>Posts favorited</a>: $i_favorites_count, $h_favorites_rate per day");
}
public function onImageInfoSet(ImageInfoSetEvent $event)

View file

@ -9,7 +9,7 @@ class FavoritesTest extends ShimmiePHPUnitTestCase
# No favourites
$this->get_page("post/view/$image_id");
$this->assert_title("Image $image_id: test");
$this->assert_title("Post $image_id: test");
$this->assert_no_text("Favorited By");
# Add a favourite
@ -17,7 +17,7 @@ class FavoritesTest extends ShimmiePHPUnitTestCase
# Favourite shown on page
$this->get_page("post/view/$image_id");
$this->assert_title("Image $image_id: test");
$this->assert_title("Post $image_id: test");
$this->assert_text("Favorited By");
# Favourite shown on index
@ -26,14 +26,14 @@ class FavoritesTest extends ShimmiePHPUnitTestCase
# Favourite shown on user page
$this->get_page("user/test");
$this->assert_text("Images favorited</a>: 1");
$this->assert_text("Posts favorited</a>: 1");
# Delete a favourite
send_event(new FavoriteSetEvent($image_id, $user, false));
# No favourites
$this->get_page("post/view/$image_id");
$this->assert_title("Image $image_id: test");
$this->assert_title("Post $image_id: test");
$this->assert_no_text("Favorited By");
}
}

View file

@ -34,23 +34,23 @@ class FavoritesTheme extends Themelet
public function get_help_html()
{
return '<p>Search for images that have been favorited a certain number of times, or favorited by a particular individual.</p>
return '<p>Search for posts that have been favorited a certain number of times, or favorited by a particular individual.</p>
<div class="command_example">
<pre>favorites=1</pre>
<p>Returns images that have been favorited once.</p>
<p>Returns posts that have been favorited once.</p>
</div>
<div class="command_example">
<pre>favorites>0</pre>
<p>Returns images that have been favorited 1 or more times</p>
<p>Returns posts that have been favorited 1 or more times</p>
</div>
<p>Can use &lt;, &lt;=, &gt;, &gt;=, or =.</p>
<div class="command_example">
<pre>favorited_by:username</pre>
<p>Returns images that have been favorited by "username". </p>
<p>Returns posts that have been favorited by "username". </p>
</div>
<div class="command_example">
<pre>favorited_by_userno:123</pre>
<p>Returns images that have been favorited by user 123. </p>
<p>Returns posts that have been favorited by user 123. </p>
</div>
';
}