Permalink
Browse files

Fixed incorrect logic in fetch_links

fetch_links was inverting the logic to determine the correct API to use
when a subreddit is specified.
  • Loading branch information...
1 parent 2fde001 commit 11128c9bac813d97b7e00bf07a9f4e123a691ca6 @sysread committed Aug 15, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/Reddit/Client.pm
View
@@ -81,7 +81,7 @@ $API[API_HIDE ] = ['POST', '/api/hide' ];
$API[API_UNHIDE ] = ['POST', '/api/unhide' ];
$API[API_SUBREDDITS ] = ['GET', '/reddits/%s' ];
$API[API_LINKS_OTHER] = ['GET', '/%s' ];
-$API[API_LINKS_FRONT] = ['GET', '/r/%s' ];
+$API[API_LINKS_FRONT] = ['GET', '/r/%s/%s' ];
$API[API_DEL ] = ['POST', '/api/del' ];
#===============================================================================
@@ -387,9 +387,12 @@ sub fetch_links {
}
$subreddit = subreddit($subreddit);
+ $args = [$view];
+ push @$args, $subreddit if $subreddit;
+
my $result = $self->api_json_request(
- api => ($subreddit ? API_LINKS_OTHER : API_LINKS_FRONT),
- args => [$view],
+ api => ($subreddit ? API_LINKS_FRONT : API_LINKS_OTHER),
+ args => $args,
data => $query,
);

0 comments on commit 11128c9

Please sign in to comment.