diff --git a/app/models/comment.rb b/app/models/comment.rb index 4df38ee..1d801cc 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -30,6 +30,8 @@ class Comment < ActiveRecord::Base rec.errors.add(:name, _('{fn} can only be informed for unauthenticated authors').fix_i18n) end end + + acts_as_having_settings :field => :setting xss_terminate :only => [ :body, :title, :name ], :on => 'validation' diff --git a/db/migrate/20140505190748_add_setting_to_comments.rb b/db/migrate/20140505190748_add_setting_to_comments.rb new file mode 100644 index 0000000..61bf704 --- /dev/null +++ b/db/migrate/20140505190748_add_setting_to_comments.rb @@ -0,0 +1,9 @@ +class AddSettingToComments < ActiveRecord::Migration + def self.up + add_column :comments, :setting, :text + end + + def self.down + remove_column :comments, :setting + end +end diff --git a/plugins/community_hub/lib/community_hub_plugin/hub.rb b/plugins/community_hub/lib/community_hub_plugin/hub.rb index 0e7275e..5aa0069 100644 --- a/plugins/community_hub/lib/community_hub_plugin/hub.rb +++ b/plugins/community_hub/lib/community_hub_plugin/hub.rb @@ -3,17 +3,16 @@ require File.dirname(__FILE__) + '/../../facebook_stream/lib_facebook_stream' class CommunityHubPlugin::Hub < Folder - settings_items :proxy_url, :type => :string, :default => 'http://161.148.1.167:3128' # Remember to use add the port, in case needed. settings_items :twitter_enabled, :type => :boolean, :default => false - settings_items :twitter_hashtags, :type => :string, :default => "participa.br,participabr,arenanetmundial,netmundial" + settings_items :twitter_hashtags, :type => :string, :default => "" settings_items :twitter_consumer_key, :type => :string, :default => "" settings_items :twitter_consumer_secret, :type => :string, :default => "" settings_items :twitter_access_token, :type => :string, :default => "" settings_items :twitter_access_token_secret, :type => :string, :default => "" settings_items :facebook_enabled, :type => :boolean, :default => false - settings_items :facebook_page_id, :type => :string, :default => "participabr" + settings_items :facebook_page_id, :type => :string, :default => "" settings_items :facebook_pooling_time, :type => :integer, :default => 5 # Time in seconds - settings_items :facebook_access_token, :type => :string, :default => 'CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH' + settings_items :facebook_access_token, :type => :string, :default => '' settings_items :pinned_messages, :type => Array, :default => [] settings_items :pinned_mediations, :type => Array, :default => [] settings_items :mediators, :type => Array, :default => [] diff --git a/plugins/community_hub/lib/ext/article.rb b/plugins/community_hub/lib/ext/article.rb deleted file mode 100644 index a125371..0000000 --- a/plugins/community_hub/lib/ext/article.rb +++ /dev/null @@ -1,12 +0,0 @@ -require_dependency 'article' - -class Article - - before_create do |article| - # if article.parent.kind_of?(CommunityDashboardPlugin::Hub) - # article.accept_comments = article.parent.accept_comments - # end - true - end - -end diff --git a/plugins/community_hub/lib/ext/comment.rb b/plugins/community_hub/lib/ext/comment.rb new file mode 100644 index 0000000..a172ad9 --- /dev/null +++ b/plugins/community_hub/lib/ext/comment.rb @@ -0,0 +1,5 @@ +require_dependency 'comment' + +class Comment + settings_items :profile_picture, :type => :string, :default => "" +end diff --git a/plugins/community_hub/twitter/stream.rb b/plugins/community_hub/twitter/stream.rb index 047832c..e94896f 100644 --- a/plugins/community_hub/twitter/stream.rb +++ b/plugins/community_hub/twitter/stream.rb @@ -42,10 +42,12 @@ def listen_twitter_stream(hub, author_id) comment = Comment.new comment.title = 'hub-message-twitter' comment.source = hub - comment.body = UTF8Filter(object.text + "#{object.user.profile_image_url}") + comment.body = UTF8Filter(object.text) + comment.profile_picture = UTF8Filter(object.user.profile_image_url) comment.author_id = author_id comment.name = UTF8Filter(object.user.screen_name) comment.email = 'admin@localhost.local' + tries = 0 begin comment.save! -- libgit2 0.21.2