Commit caf264468071a2636d0150726742171d0a331dca

Authored by Rodrigo Souto
2 parents 96a2e91e 32b977e3

Merge branch 'stable'

@@ -6,15 +6,13 @@ To configure XMPP/BOSH in Noosfero you need: @@ -6,15 +6,13 @@ To configure XMPP/BOSH in Noosfero you need:
6 * SystemTimer - http://ph7spot.com/musings/system-timer 6 * SystemTimer - http://ph7spot.com/musings/system-timer
7 * Pidgin data files - http://www.pidgin.im/ 7 * Pidgin data files - http://www.pidgin.im/
8 8
9 -If you use Debian Lenny: 9 +If you use Debian Wheezy:
10 10
11 -# apt-get install librestclient-ruby (from backports)  
12 -# apt-get install pidgin-data  
13 -# apt-get install ruby1.8-dev 11 +# apt-get install librestclient-ruby pidgin-data ruby1.8-dev
14 # gem install SystemTimer 12 # gem install SystemTimer
15 13
16 -Take a look at util/chat directory to see samples of config file to configure a  
17 -XMPP/BOSH server with ejabberd, postgresql and apache2. 14 +The samples of config file to configure a XMPP/BOSH server with
  15 +ejabberd, postgresql and apache2 can be found at util/chat directory.
18 16
19 == XMPP/Chat Server Setup 17 == XMPP/Chat Server Setup
20 18
@@ -22,8 +20,7 @@ This is a step-by-step guide to get a XMPP service working, in a Debian system. @@ -22,8 +20,7 @@ This is a step-by-step guide to get a XMPP service working, in a Debian system.
22 20
23 1. Install the required packages 21 1. Install the required packages
24 22
25 -# apt-get -t lenny-backports install ejabberd  
26 -# apt-get install odbc-postgresql 23 +# apt-get install ejabberd odbc-postgresql
27 24
28 2. Ejabberd configuration 25 2. Ejabberd configuration
29 26
@@ -108,7 +105,7 @@ Unused modules can be disabled, for example: @@ -108,7 +105,7 @@ Unused modules can be disabled, for example:
108 * web_admin 105 * web_admin
109 * mod_pubsub 106 * mod_pubsub
110 * mod_irc 107 * mod_irc
111 - * mod_offine 108 + * mod_offline
112 * mod_admin_extra 109 * mod_admin_extra
113 * mod_register 110 * mod_register
114 111
@@ -132,7 +129,7 @@ This will create a new schema inside the noosfero database, called 'ejabberd'. @@ -132,7 +129,7 @@ This will create a new schema inside the noosfero database, called 'ejabberd'.
132 129
133 Note 'noosfero' user should have permission to create Postgresql schemas. Also, 130 Note 'noosfero' user should have permission to create Postgresql schemas. Also,
134 there should be at least one domain with 'is_default = true' in 'domains' 131 there should be at least one domain with 'is_default = true' in 'domains'
135 -table, otherwise people couldn't see your friends online. 132 +table, otherwise people won't be able to see their friends online.
136 133
137 134
138 4. ODBC configuration 135 4. ODBC configuration
@@ -168,9 +165,12 @@ Debug = 0 @@ -168,9 +165,12 @@ Debug = 0
168 CommLog = 1 165 CommLog = 1
169 UsageCount = 3 166 UsageCount = 3
170 167
171 - * testing all: 168 + 4.1 testing all:
172 169
173 -# isql 'PostgreSQLEjabberdNoosfero' DBUSER 170 +# isql 'PostgreSQLEjabberdNoosfero'
  171 +
  172 +If the configuration was done right, the message "Connected!"
  173 +will be displayed.
174 174
175 175
176 5. Enabling kernel polling and SMP in /etc/default/ejabberd 176 5. Enabling kernel polling and SMP in /etc/default/ejabberd
app/helpers/forms_helper.rb
@@ -244,7 +244,7 @@ module FormsHelper @@ -244,7 +244,7 @@ module FormsHelper
244 yearSuffix: #{datepicker_options[:year_suffix].to_json} 244 yearSuffix: #{datepicker_options[:year_suffix].to_json}
245 }) 245 })
246 </script> 246 </script>
247 - " 247 + ".html_safe
248 result 248 result
249 end 249 end
250 250
app/helpers/layout_helper.rb
@@ -84,5 +84,11 @@ module LayoutHelper @@ -84,5 +84,11 @@ module LayoutHelper
84 theme_path + '/style.css' 84 theme_path + '/style.css'
85 end 85 end
86 86
  87 + def addthis_javascript
  88 + if NOOSFERO_CONF['addthis_enabled']
  89 + '<script src="http://s7.addthis.com/js/152/addthis_widget.js"></script>'
  90 + end
  91 + end
  92 +
87 end 93 end
88 94
app/models/article.rb
@@ -595,7 +595,7 @@ class Article &lt; ActiveRecord::Base @@ -595,7 +595,7 @@ class Article &lt; ActiveRecord::Base
595 end 595 end
596 596
597 def lead 597 def lead
598 - abstract.blank? ? first_paragraph : abstract 598 + abstract.blank? ? first_paragraph.html_safe : abstract.html_safe
599 end 599 end
600 600
601 def short_lead 601 def short_lead
app/models/event.rb
@@ -14,7 +14,6 @@ class Event &lt; Article @@ -14,7 +14,6 @@ class Event &lt; Article
14 maybe_add_http(self.setting[:link]) 14 maybe_add_http(self.setting[:link])
15 end 15 end
16 16
17 - xss_terminate :only => [ :link ], :on => 'validation'  
18 xss_terminate :only => [ :body, :link, :address ], :with => 'white_list', :on => 'validation' 17 xss_terminate :only => [ :body, :link, :address ], :with => 'white_list', :on => 'validation'
19 18
20 def initialize(*args) 19 def initialize(*args)
app/models/user.rb
@@ -294,7 +294,8 @@ class User &lt; ActiveRecord::Base @@ -294,7 +294,8 @@ class User &lt; ActiveRecord::Base
294 'email_domain' => self.enable_email ? self.email_domain : nil, 294 'email_domain' => self.enable_email ? self.email_domain : nil,
295 'friends_list' => friends_list, 295 'friends_list' => friends_list,
296 'enterprises' => enterprises, 296 'enterprises' => enterprises,
297 - 'amount_of_friends' => friends_list.count 297 + 'amount_of_friends' => friends_list.count,
  298 + 'chat_enabled' => person.environment.enabled?('xmpp_chat')
298 } 299 }
299 end 300 end
300 301
app/views/content_viewer/view_page.rhtml
@@ -60,7 +60,6 @@ @@ -60,7 +60,6 @@
60 addthis_options = '<%= escape_javascript( NOOSFERO_CONF['addthis_options'] ) %>'; 60 addthis_options = '<%= escape_javascript( NOOSFERO_CONF['addthis_options'] ) %>';
61 </script> 61 </script>
62 <a href="http://www.addthis.com/bookmark.php" id="bt_addThis" target="_blank" onmouseover="return addthis_open(this, '', '[URL]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><%= addthis_image_tag %></a> 62 <a href="http://www.addthis.com/bookmark.php" id="bt_addThis" target="_blank" onmouseover="return addthis_open(this, '', '[URL]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><%= addthis_image_tag %></a>
63 -<script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script>  
64 </div> 63 </div>
65 <% end %> 64 <% end %>
66 65
app/views/layouts/application-ng.rhtml
@@ -56,5 +56,6 @@ @@ -56,5 +56,6 @@
56 </div><!-- end id="theme-footer" --> 56 </div><!-- end id="theme-footer" -->
57 <%= noosfero_layout_features %> 57 <%= noosfero_layout_features %>
58 <%= theme_javascript_ng %> 58 <%= theme_javascript_ng %>
  59 + <%= addthis_javascript %>
59 </body> 60 </body>
60 </html> 61 </html>
app/views/shared/logged_in/xmpp_chat.rhtml
@@ -6,6 +6,6 @@ @@ -6,6 +6,6 @@
6 </div> 6 </div>
7 </div> 7 </div>
8 <a href='#' id='chat-online-users-title' onclick='return false;'> 8 <a href='#' id='chat-online-users-title' onclick='return false;'>
9 - <div class='header'><i class='icon-chat'></i><span><%= _("Friends in chat <span class='amount_of_friends'>(%{amount})</span>") %></span></div> 9 + <div class='header'><i class='icon-chat'></i><span><%= _("Friends in chat (<span class='amount_of_friends'>%{amount}</span>)") %></span></div>
10 </a> 10 </a>
11 </div> 11 </div>
db/migrate/20130605135210_change_article_published_at_from_date_to_datetime.rb 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +class ChangeArticlePublishedAtFromDateToDatetime < ActiveRecord::Migration
  2 + def self.up
  3 + change_column :articles, :published_at, :datetime
  4 + end
  5 +
  6 + def self.down
  7 + change_column :articles, :published_at, :date
  8 + end
  9 +end
db/migrate/20130606110602_change_article_versions_published_at_from_date_to_datetime.rb 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +class ChangeArticleVersionsPublishedAtFromDateToDatetime < ActiveRecord::Migration
  2 + def self.up
  3 + change_column :article_versions, :published_at, :datetime
  4 + end
  5 +
  6 + def self.down
  7 + change_column :article_versions, :published_at, :date
  8 + end
  9 +end
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 # 9 #
10 # It's strongly recommended to check this file into your version control system. 10 # It's strongly recommended to check this file into your version control system.
11 11
12 -ActiveRecord::Schema.define(:version => 20130429214630) do 12 +ActiveRecord::Schema.define(:version => 20130606110602) do
13 13
14 create_table "abuse_reports", :force => true do |t| 14 create_table "abuse_reports", :force => true do |t|
15 t.integer "reporter_id" 15 t.integer "reporter_id"
@@ -76,7 +76,7 @@ ActiveRecord::Schema.define(:version =&gt; 20130429214630) do @@ -76,7 +76,7 @@ ActiveRecord::Schema.define(:version =&gt; 20130429214630) do
76 t.text "setting" 76 t.text "setting"
77 t.boolean "notify_comments", :default => false 77 t.boolean "notify_comments", :default => false
78 t.integer "hits", :default => 0 78 t.integer "hits", :default => 0
79 - t.date "published_at" 79 + t.datetime "published_at"
80 t.string "source" 80 t.string "source"
81 t.boolean "highlighted", :default => false 81 t.boolean "highlighted", :default => false
82 t.string "external_link" 82 t.string "external_link"
@@ -119,7 +119,7 @@ ActiveRecord::Schema.define(:version =&gt; 20130429214630) do @@ -119,7 +119,7 @@ ActiveRecord::Schema.define(:version =&gt; 20130429214630) do
119 t.text "setting" 119 t.text "setting"
120 t.boolean "notify_comments", :default => true 120 t.boolean "notify_comments", :default => true
121 t.integer "hits", :default => 0 121 t.integer "hits", :default => 0
122 - t.date "published_at" 122 + t.datetime "published_at"
123 t.string "source" 123 t.string "source"
124 t.boolean "highlighted", :default => false 124 t.boolean "highlighted", :default => false
125 t.string "external_link" 125 t.string "external_link"
@@ -264,11 +264,11 @@ ActiveRecord::Schema.define(:version =&gt; 20130429214630) do @@ -264,11 +264,11 @@ ActiveRecord::Schema.define(:version =&gt; 20130429214630) do
264 t.text "design_data" 264 t.text "design_data"
265 t.text "custom_header" 265 t.text "custom_header"
266 t.text "custom_footer" 266 t.text "custom_footer"
267 - t.string "theme", :default => "default", :null => false 267 + t.string "theme", :default => "default", :null => false
268 t.text "terms_of_use_acceptance_text" 268 t.text "terms_of_use_acceptance_text"
269 t.datetime "created_at" 269 t.datetime "created_at"
270 t.datetime "updated_at" 270 t.datetime "updated_at"
271 - t.integer "reports_lower_bound", :default => 0, :null => false 271 + t.integer "reports_lower_bound", :default => 0, :null => false
272 t.string "redirection_after_login", :default => "keep_on_same_page" 272 t.string "redirection_after_login", :default => "keep_on_same_page"
273 t.text "signup_welcome_text" 273 t.text "signup_welcome_text"
274 t.string "languages" 274 t.string "languages"
@@ -428,7 +428,7 @@ ActiveRecord::Schema.define(:version =&gt; 20130429214630) do @@ -428,7 +428,7 @@ ActiveRecord::Schema.define(:version =&gt; 20130429214630) do
428 t.string "type" 428 t.string "type"
429 t.string "identifier" 429 t.string "identifier"
430 t.integer "environment_id" 430 t.integer "environment_id"
431 - t.boolean "active", :default => true 431 + t.boolean "active", :default => true
432 t.string "address" 432 t.string "address"
433 t.string "contact_phone" 433 t.string "contact_phone"
434 t.integer "home_page_id" 434 t.integer "home_page_id"
@@ -439,21 +439,21 @@ ActiveRecord::Schema.define(:version =&gt; 20130429214630) do @@ -439,21 +439,21 @@ ActiveRecord::Schema.define(:version =&gt; 20130429214630) do
439 t.float "lat" 439 t.float "lat"
440 t.float "lng" 440 t.float "lng"
441 t.integer "geocode_precision" 441 t.integer "geocode_precision"
442 - t.boolean "enabled", :default => true  
443 - t.string "nickname", :limit => 16 442 + t.boolean "enabled", :default => true
  443 + t.string "nickname", :limit => 16
444 t.text "custom_header" 444 t.text "custom_header"
445 t.text "custom_footer" 445 t.text "custom_footer"
446 t.string "theme" 446 t.string "theme"
447 - t.boolean "public_profile", :default => true 447 + t.boolean "public_profile", :default => true
448 t.date "birth_date" 448 t.date "birth_date"
449 t.integer "preferred_domain_id" 449 t.integer "preferred_domain_id"
450 t.datetime "updated_at" 450 t.datetime "updated_at"
451 - t.boolean "visible", :default => true 451 + t.boolean "visible", :default => true
452 t.integer "image_id" 452 t.integer "image_id"
453 - t.boolean "validated", :default => true 453 + t.boolean "validated", :default => true
454 t.string "cnpj" 454 t.string "cnpj"
455 t.string "national_region_code" 455 t.string "national_region_code"
456 - t.boolean "is_template", :default => false 456 + t.boolean "is_template", :default => false
457 t.integer "template_id" 457 t.integer "template_id"
458 t.string "redirection_after_login" 458 t.string "redirection_after_login"
459 end 459 end
plugins/custom_forms/controllers/custom_forms_plugin_profile_controller.rb
@@ -27,6 +27,7 @@ class CustomFormsPluginProfileController &lt; ProfileController @@ -27,6 +27,7 @@ class CustomFormsPluginProfileController &lt; ProfileController
27 failed_answers.each do |answer| 27 failed_answers.each do |answer|
28 @submission.errors.add(answer.field.name.to_sym, answer.errors[answer.field.slug.to_sym]) 28 @submission.errors.add(answer.field.name.to_sym, answer.errors[answer.field.slug.to_sym])
29 end 29 end
  30 + raise 'Submission failed: answers not valid'
30 end 31 end
31 session[:notice] = _('Submission saved') 32 session[:notice] = _('Submission saved')
32 redirect_to :action => 'show' 33 redirect_to :action => 'show'
plugins/custom_forms/lib/custom_forms_plugin/helper.rb
@@ -103,14 +103,17 @@ module CustomFormsPlugin::Helper @@ -103,14 +103,17 @@ module CustomFormsPlugin::Helper
103 103
104 def build_answers(submission, form) 104 def build_answers(submission, form)
105 answers = [] 105 answers = []
106 - submission.each do |slug, value|  
107 - field = form.fields.select {|field| field.slug==slug}.first  
108 - if value.kind_of?(String)  
109 - final_value = value  
110 - elsif value.kind_of?(Array)  
111 - final_value = value.join(',')  
112 - elsif value.kind_of?(Hash)  
113 - final_value = value.map {|option, present| present == '1' ? option : nil}.compact.join(',') 106 + form.fields.each do |field|
  107 + final_value = ''
  108 + if submission.has_key?(field.slug)
  109 + value = submission[field.slug]
  110 + if value.kind_of?(String)
  111 + final_value = value
  112 + elsif value.kind_of?(Array)
  113 + final_value = value.join(',')
  114 + elsif value.kind_of?(Hash)
  115 + final_value = value.map {|option, present| present == '1' ? option : nil}.compact.join(',')
  116 + end
114 end 117 end
115 answers << CustomFormsPlugin::Answer.new(:field => field, :value => final_value) 118 answers << CustomFormsPlugin::Answer.new(:field => field, :value => final_value)
116 end 119 end
plugins/custom_forms/public/field.js
@@ -8,7 +8,6 @@ jQuery(&#39;.icon-edit&#39;).live(&#39;click&#39;, function() { @@ -8,7 +8,6 @@ jQuery(&#39;.icon-edit&#39;).live(&#39;click&#39;, function() {
8 id = jQuery(elem).attr('field_id'); 8 id = jQuery(elem).attr('field_id');
9 type = jQuery('#fields_'+id+'_type').val().split('_')[0]; 9 type = jQuery('#fields_'+id+'_type').val().split('_')[0];
10 selector = '#edit-'+type+'-'+id 10 selector = '#edit-'+type+'-'+id
11 - jQuery(selector).show();  
12 return selector 11 return selector
13 } 12 }
14 }); 13 });
plugins/custom_forms/public/style.css
@@ -28,3 +28,6 @@ @@ -28,3 +28,6 @@
28 .edit-information { 28 .edit-information {
29 display: none; 29 display: none;
30 } 30 }
  31 +#colorbox .edit-information {
  32 + display: block;
  33 +}
plugins/custom_forms/test/functional/custom_forms_plugin_profile_controller_test.rb 0 → 100644
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  1 +require File.dirname(__FILE__) + '/../../../../test/test_helper'
  2 +require File.dirname(__FILE__) + '/../../controllers/custom_forms_plugin_profile_controller'
  3 +
  4 +# Re-raise errors caught by the controller.
  5 +class CustomFormsPluginProfileController; def rescue_action(e) raise e end; end
  6 +
  7 +class CustomFormsPluginProfileControllerTest < ActionController::TestCase
  8 + def setup
  9 + @controller = CustomFormsPluginProfileController.new
  10 + @request = ActionController::TestRequest.new
  11 + @response = ActionController::TestResponse.new
  12 + @profile = create_user('profile').person
  13 + login_as(@profile.identifier)
  14 + environment = Environment.default
  15 + environment.enable_plugin(CustomFormsPlugin)
  16 + end
  17 +
  18 + attr_reader :profile
  19 +
  20 + should 'save submission if fields are ok' do
  21 + form = CustomFormsPlugin::Form.create!(:profile => profile, :name => 'Free Software')
  22 + field1 = CustomFormsPlugin::TextField.create(:name => 'Name', :form => form, :mandatory => true)
  23 + field2 = CustomFormsPlugin::TextField.create(:name => 'License', :form => form)
  24 +
  25 + assert_difference CustomFormsPlugin::Submission, :count, 1 do
  26 + post :show, :profile => profile.identifier, :id => form.id, :submission => {field1.name.to_slug => 'Noosfero', field2.name.to_slug => 'GPL'}
  27 + end
  28 + assert !session[:notice].include?('not saved')
  29 + assert_redirected_to :action => 'show'
  30 + end
  31 +end
plugins/custom_forms/views/custom_forms_plugin_myprofile/_empty_option.html.erb
1 <tr id=<%= "empty-option-#{counter}" %> option_id=<%= option_counter %> style="display: none;"> 1 <tr id=<%= "empty-option-#{counter}" %> option_id=<%= option_counter %> style="display: none;">
2 <td><%= text_field_tag("fields[#{counter}][choices][#{option_counter}][name]") %></td> 2 <td><%= text_field_tag("fields[#{counter}][choices][#{option_counter}][name]") %></td>
3 - <td><%= text_field_tag("fields[#{counter}][choices][#{option_counter}][value]", nil, :size => 15) %></td> 3 + <td><%= text_field_tag("fields[#{counter}][choices][#{option_counter}][value]") %></td>
4 <td class='actions'> 4 <td class='actions'>
5 <%= button_without_text :remove, _('Remove'), '#', :class => 'remove-option', :field_id => counter, :option_id => option_counter, :confirm => _('Are you sure you want to remove this option?') %> 5 <%= button_without_text :remove, _('Remove'), '#', :class => 'remove-option', :field_id => counter, :option_id => option_counter, :confirm => _('Are you sure you want to remove this option?') %>
6 </td> 6 </td>
public/javascripts/application.js
@@ -486,7 +486,9 @@ jQuery(function($) { @@ -486,7 +486,9 @@ jQuery(function($) {
486 // logged in 486 // logged in
487 loggedInDataCallBack(data); 487 loggedInDataCallBack(data);
488 addManageEnterprisesToOldStyleMenu(data); 488 addManageEnterprisesToOldStyleMenu(data);
489 - chatOnlineUsersDataCallBack(data); 489 + if (data.chat_enabled) {
  490 + setInterval(function(){ $.getJSON('/account/user_data', chatOnlineUsersDataCallBack)}, 10000);
  491 + }
490 } else { 492 } else {
491 // not logged in 493 // not logged in
492 $('#user .not-logged-in, .login-block .not-logged-user').fadeIn(); 494 $('#user .not-logged-in, .login-block .not-logged-user').fadeIn();
@@ -538,7 +540,7 @@ jQuery(function($) { @@ -538,7 +540,7 @@ jQuery(function($) {
538 return; 540 return;
539 } 541 }
540 var content = ''; 542 var content = '';
541 - $('#chat-online-users').html($('#chat-online-users').html().replace(/%{amount}/g, data['amount_of_friends'])); 543 + $('#chat-online-users .amount_of_friends').html(data['amount_of_friends']);
542 $('#chat-online-users').fadeIn(); 544 $('#chat-online-users').fadeIn();
543 for (var user in data['friends_list']) { 545 for (var user in data['friends_list']) {
544 var name = "<span class='friend_name'>%{name}</span>"; 546 var name = "<span class='friend_name'>%{name}</span>";
public/javascripts/chat.js
@@ -253,7 +253,7 @@ jQuery(function($) { @@ -253,7 +253,7 @@ jQuery(function($) {
253 result.show = 'away'; 253 result.show = 'away';
254 } 254 }
255 } 255 }
256 - if ($(stanza).find('x[xmlns='+ Strophe.NS.MUC_USER +']').length > 0) { 256 + if ($(stanza).find('x[xmlns="'+ Strophe.NS.MUC_USER +'"]').length > 0) {
257 result.is_from_room = true; 257 result.is_from_room = true;
258 result.from_user = $(stanza).find('x item').attr('jid'); 258 result.from_user = $(stanza).find('x item').attr('jid');
259 if ($(stanza).find('x item').attr('affiliation') == 'owner') { 259 if ($(stanza).find('x item').attr('affiliation') == 'owner') {
@@ -351,7 +351,7 @@ jQuery(function($) { @@ -351,7 +351,7 @@ jQuery(function($) {
351 }, 351 },
352 352
353 on_muc_support: function(iq) { 353 on_muc_support: function(iq) {
354 - if ($(iq).find('identity[category=conference]').length > 0 && $(iq).find('feature[var='+ Strophe.NS.MUC +']').length > 0) { 354 + if ($(iq).find('identity[category=conference]').length > 0 && $(iq).find('feature[var="'+ Strophe.NS.MUC +'"]').length > 0) {
355 var name = $(iq).find('identity[category=conference]').attr('name'); 355 var name = $(iq).find('identity[category=conference]').attr('name');
356 log('muc support found with identity '+ name); 356 log('muc support found with identity '+ name);
357 Jabber.muc_supported = true; 357 Jabber.muc_supported = true;
public/stylesheets/application.css
@@ -4884,6 +4884,11 @@ h1#agenda-title { @@ -4884,6 +4884,11 @@ h1#agenda-title {
4884 #chat-window .history .message h5, #chat-window .history .message p { 4884 #chat-window .history .message h5, #chat-window .history .message p {
4885 margin: 0; 4885 margin: 0;
4886 } 4886 }
  4887 +#chat-window .history .message p {
  4888 + max-width: 100%;
  4889 + overflow: auto;
  4890 +}
  4891 +
4887 #chat-window .history .message .avatar { 4892 #chat-window .history .message .avatar {
4888 position: absolute; 4893 position: absolute;
4889 left: 0; 4894 left: 0;
test/unit/block_helper_test.rb
1 require File.dirname(__FILE__) + '/../test_helper' 1 require File.dirname(__FILE__) + '/../test_helper'
2 2
3 -class BlogHelperTest < ActiveSupport::TestCase 3 +class BlockHelperTest < ActiveSupport::TestCase
4 4
5 include BlockHelper 5 include BlockHelper
6 include ActionView::Helpers::TagHelper 6 include ActionView::Helpers::TagHelper
test/unit/event_test.rb
@@ -234,6 +234,14 @@ class EventTest &lt; ActiveSupport::TestCase @@ -234,6 +234,14 @@ class EventTest &lt; ActiveSupport::TestCase
234 assert_equal "<strong> Address <strong>", event.address 234 assert_equal "<strong> Address <strong>", event.address
235 end 235 end
236 236
  237 + should 'not filter & on link field' do
  238 + event = Event.new
  239 + event.link = 'myevent.com/?param1=value&param2=value2'
  240 + event.valid?
  241 +
  242 + assert_equal "http://myevent.com/?param1=value&param2=value2", event.link
  243 + end
  244 +
237 should 'escape malformed html tags' do 245 should 'escape malformed html tags' do
238 event = Event.new 246 event = Event.new
239 event.body = "<h1<< Description >>/h1>" 247 event.body = "<h1<< Description >>/h1>"
test/unit/user_test.rb
@@ -335,7 +335,7 @@ class UserTest &lt; ActiveSupport::TestCase @@ -335,7 +335,7 @@ class UserTest &lt; ActiveSupport::TestCase
335 Person.any_instance.stubs(:is_admin?).returns(true) 335 Person.any_instance.stubs(:is_admin?).returns(true)
336 Person.any_instance.stubs(:created_at).returns(DateTime.parse('16-08-2010')) 336 Person.any_instance.stubs(:created_at).returns(DateTime.parse('16-08-2010'))
337 expected_hash = { 337 expected_hash = {
338 - 'login' => 'x_and_y', 'is_admin' => true, 'since_month' => 8, 'since_year' => 2010, 'email_domain' => nil, 'amount_of_friends' => 0, 338 + 'login' => 'x_and_y', 'is_admin' => true, 'since_month' => 8, 'chat_enabled' => false, 'since_year' => 2010, 'email_domain' => nil, 'amount_of_friends' => 0,
339 'friends_list' => {}, 'enterprises' => [], 339 'friends_list' => {}, 'enterprises' => [],
340 } 340 }
341 assert_equal expected_hash, person.user.data_hash 341 assert_equal expected_hash, person.user.data_hash
@@ -399,6 +399,19 @@ class UserTest &lt; ActiveSupport::TestCase @@ -399,6 +399,19 @@ class UserTest &lt; ActiveSupport::TestCase
399 assert_equal 15, User.expires_chat_status_every 399 assert_equal 15, User.expires_chat_status_every
400 end 400 end
401 401
  402 + should "return status of chat on environment in data_hash" do
  403 + person = create_user('coldplay').person
  404 + env = person.environment
  405 + env.enable('xmpp_chat')
  406 + env.save
  407 + assert_equal true, person.user.data_hash['chat_enabled']
  408 +
  409 + env.disable('xmpp_chat')
  410 + env.save
  411 + person.reload
  412 + assert_equal false, person.user.data_hash['chat_enabled']
  413 + end
  414 +
402 should 'respond name with related person name' do 415 should 'respond name with related person name' do
403 user = create_user('testuser') 416 user = create_user('testuser')
404 user.person.name = 'Test User' 417 user.person.name = 'Test User'