Commit 878a5679b1562bfe8747c1d0742aa72de1a43991
1 parent
635cd878
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
twitter profile picture as a comment setting
Showing
6 changed files
with
22 additions
and
17 deletions
Show diff stats
app/models/comment.rb
| ... | ... | @@ -30,6 +30,8 @@ class Comment < ActiveRecord::Base |
| 30 | 30 | rec.errors.add(:name, _('{fn} can only be informed for unauthenticated authors').fix_i18n) |
| 31 | 31 | end |
| 32 | 32 | end |
| 33 | + | |
| 34 | + acts_as_having_settings :field => :setting | |
| 33 | 35 | |
| 34 | 36 | xss_terminate :only => [ :body, :title, :name ], :on => 'validation' |
| 35 | 37 | ... | ... |
plugins/community_hub/lib/community_hub_plugin/hub.rb
| ... | ... | @@ -3,17 +3,16 @@ require File.dirname(__FILE__) + '/../../facebook_stream/lib_facebook_stream' |
| 3 | 3 | |
| 4 | 4 | class CommunityHubPlugin::Hub < Folder |
| 5 | 5 | |
| 6 | - settings_items :proxy_url, :type => :string, :default => 'http://161.148.1.167:3128' # Remember to use add the port, in case needed. | |
| 7 | 6 | settings_items :twitter_enabled, :type => :boolean, :default => false |
| 8 | - settings_items :twitter_hashtags, :type => :string, :default => "participa.br,participabr,arenanetmundial,netmundial" | |
| 7 | + settings_items :twitter_hashtags, :type => :string, :default => "" | |
| 9 | 8 | settings_items :twitter_consumer_key, :type => :string, :default => "" |
| 10 | 9 | settings_items :twitter_consumer_secret, :type => :string, :default => "" |
| 11 | 10 | settings_items :twitter_access_token, :type => :string, :default => "" |
| 12 | 11 | settings_items :twitter_access_token_secret, :type => :string, :default => "" |
| 13 | 12 | settings_items :facebook_enabled, :type => :boolean, :default => false |
| 14 | - settings_items :facebook_page_id, :type => :string, :default => "participabr" | |
| 13 | + settings_items :facebook_page_id, :type => :string, :default => "" | |
| 15 | 14 | settings_items :facebook_pooling_time, :type => :integer, :default => 5 # Time in seconds |
| 16 | - settings_items :facebook_access_token, :type => :string, :default => 'CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH' | |
| 15 | + settings_items :facebook_access_token, :type => :string, :default => '' | |
| 17 | 16 | settings_items :pinned_messages, :type => Array, :default => [] |
| 18 | 17 | settings_items :pinned_mediations, :type => Array, :default => [] |
| 19 | 18 | settings_items :mediators, :type => Array, :default => [] | ... | ... |
plugins/community_hub/lib/ext/article.rb
plugins/community_hub/twitter/stream.rb
| ... | ... | @@ -42,10 +42,12 @@ def listen_twitter_stream(hub, author_id) |
| 42 | 42 | comment = Comment.new |
| 43 | 43 | comment.title = 'hub-message-twitter' |
| 44 | 44 | comment.source = hub |
| 45 | - comment.body = UTF8Filter(object.text + "<picture>#{object.user.profile_image_url}</picture>") | |
| 45 | + comment.body = UTF8Filter(object.text) | |
| 46 | + comment.profile_picture = UTF8Filter(object.user.profile_image_url) | |
| 46 | 47 | comment.author_id = author_id |
| 47 | 48 | comment.name = UTF8Filter(object.user.screen_name) |
| 48 | 49 | comment.email = 'admin@localhost.local' |
| 50 | + | |
| 49 | 51 | tries = 0 |
| 50 | 52 | begin |
| 51 | 53 | comment.save! | ... | ... |