Permalink
Browse files

configurable to show retweets in user timeline

  • Loading branch information...
1 parent 6ae3d8b commit 80bd1bb96ecaa46df864e49baa331ac3fad7d9ae @will-r will-r committed Nov 8, 2011
Showing with 8 additions and 4 deletions.
  1. +1 −0 config/initializers/radiant_config.rb
  2. +1 −1 lib/radiant-twitter-extension.rb
  3. +6 −3 lib/twitter_tags.rb
@@ -4,5 +4,6 @@
twit.define 'password', :default => '', :allow_blank => true
twit.define 'token', :default => '', :allow_blank => true
twit.define 'secret', :default => '', :allow_blank => true
+ twit.define 'include_rts?', :default => true
end
end
@@ -1,5 +1,5 @@
module RadiantTwitterExtension
- VERSION = '2.0.5'
+ VERSION = '2.0.6'
SUMMARY = %q{Twitter posting and radius tags for twitter feeds.}
DESCRIPTION = %q{Posts notification of pages to Twitter and provides radiius tags to display the results of twitter searches.}
URL = "http://github.com/radiant/radiant-twitter-extension"
View
@@ -301,9 +301,10 @@ class TagError < StandardError; end
}
tag 'tweet:permalink' do |tag|
cssclass = tag.attr['class'] || 'twitter_permalink'
+ tweet = tag.locals.tweet
screen_name = tweet.from_user || tweet.user.screen_name # search returns a different data structure
- text = tag.double? ? tag.expand : I18n.l(DateTime.parse(tag.locals.tweet.created_at), :format => :twitter)
- %{<a class="#{cssclass}" href="http://twitter.com/#!/#{screen_name}/status/#{tag.locals.tweet.id_str}">#{text}</a>}
+ text = tag.double? ? tag.expand : I18n.l(DateTime.parse(tweet.created_at), :format => :twitter)
+ %{<a class="#{cssclass}" href="http://twitter.com/#!/#{screen_name}/status/#{tweet.id_str}">#{text}</a>}
end
desc %{
@@ -350,11 +351,13 @@ def twitter_status(max = 1)
# other options are passed through (to non-search calls) unchanged.
#
def fetch_and_cache_tweets(options = {})
- max = options.delete(:max) || 10
+ options.reverse_merge! :include_rts => Radiant.config['twitter.include_rts?']
user = options.delete(:username) || Radiant.config['twitter.username']
list = options.delete(:list) || Radiant.config['twitter.listname']
search = options.delete(:search)
+ max = options.delete(:max) || 10
options[:count] ||= max
+
cache_key = ['twitter', list, user, max, search].compact.join('_')
begin
tweets = Rails.cache.fetch(cache_key,:expires_in => twitter_cache_duration) do

0 comments on commit 80bd1bb

Please sign in to comment.