diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b4561f80..a6b51172 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -196,15 +196,15 @@ module ApplicationHelper # do not change string; URL is alreay linked href else - content_tag(:a, h(href), :href => h(href)) + content = content_tag(:a, h(href), :href => h(href)) end end end def format_note(note) - note = markdown(note) note = auto_link_message(note) - note = auto_link(note) + note = markdown(note) + note = auto_link(note, :link => :urls) # add onenote and message protocols Sanitize::Config::RELAXED[:protocols]['a']['href'] << 'onenote' diff --git a/app/models/todo.rb b/app/models/todo.rb index 38580d3f..7fd64628 100644 --- a/app/models/todo.rb +++ b/app/models/todo.rb @@ -288,7 +288,7 @@ class Todo < ActiveRecord::Base end def notes=(value) - super(value.gsub(//, '>')) + super(value.try(:gsub, //, '>')) end def raw_notes=(value) diff --git a/spec/models/message_gateway_spec.rb b/spec/models/message_gateway_spec.rb index 2f0f5efc..188093ee 100644 --- a/spec/models/message_gateway_spec.rb +++ b/spec/models/message_gateway_spec.rb @@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../spec_helper' describe MessageGateway do before :each do - todo = mock_model(Todo, :description= => nil, :notes= => nil, :context_id= => nil, :save! => nil) + todo = mock_model(Todo, :description= => nil, :raw_notes= => nil, :context_id= => nil, :save! => nil) @user = mock_model(User, :prefs => mock_model(Preference, :sms_context => mock_model(Context)), diff --git a/test/fixtures/contexts.yml b/test/fixtures/contexts.yml index 87ea5dba..49ce9d2f 100644 --- a/test/fixtures/contexts.yml +++ b/test/fixtures/contexts.yml @@ -131,21 +131,3 @@ anothercontext: user_id: 4 created_at: <%= today %> updated_at: <%= today %> - -inbox: - id: 15 - name: Inbox - position: 1 - hide: false - user_id: 5 - created_at: <%= today %> - updated_at: <%= today %> - -anothercontext: - id: 16 - name: anothercontext - position: 2 - hide: false - user_id: 5 - created_at: <%= today %> - updated_at: <%= today %> \ No newline at end of file diff --git a/test/fixtures/preferences.yml b/test/fixtures/preferences.yml index 77129787..b047f8d6 100644 --- a/test/fixtures/preferences.yml +++ b/test/fixtures/preferences.yml @@ -54,21 +54,3 @@ sms_user_prefs: show_project_on_todo_done: true sms_email: 5555555555@tmomail.net sms_context_id: 13 - -other_user_prefs: - id: 4 - user_id: 5 - staleness_starts: 7 - date_format: "%d/%m/%Y" - title_date_format: "%A, %d %B %Y" - show_number_completed: 5 - show_completed_projects_in_sidebar: true - show_hidden_contexts_in_sidebar: true - show_hidden_projects_in_sidebar: true - admin_email: butshesagirl@rousette.org.uk - week_starts: 1 - due_style: 0 - refresh: 0 - time_zone: "Los_Angeles" - verbose_action_descriptors: false - show_project_on_todo_done: true diff --git a/test/functional/todos_controller_test.rb b/test/functional/todos_controller_test.rb index 855b8397..0035f291 100644 --- a/test/functional/todos_controller_test.rb +++ b/test/functional/todos_controller_test.rb @@ -542,10 +542,9 @@ class TodosControllerTest < ActionController::TestCase def test_format_note_link_message login_as(:admin_user) todo = users(:admin_user).todos.first - todo.notes = "A Mail.app message:// link" + todo.raw_notes = "A Mail.app message:// link" todo.save! get :index - # puts css_select("div#notes_todo_#{todo.id}") assert_select("div#notes_todo_#{todo.id}", 'A Mail.app message://<ABCDEF-GHADB-123455-FOO-BAR@example.com> link') assert_select("div#notes_todo_#{todo.id} a", 'message://<ABCDEF-GHADB-123455-FOO-BAR@example.com>') assert_select("div#notes_todo_#{todo.id} a[href=message://<ABCDEF-GHADB-123455-FOO-BAR@example.com>]", 'message://<ABCDEF-GHADB-123455-FOO-BAR@example.com>') diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index 9b03043c..e53942cc 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -52,8 +52,9 @@ class UsersControllerTest < ActionController::TestCase def test_destroy_user login_as :admin_user @no_users_before = User.find(:all).size - xhr :post, :destroy, :id => users(:ldap_user).id.to_param - assert_rjs :page, "user-3", :remove + user_id = users(:ldap_user).id + xhr :post, :destroy, :id => user_id.to_param + assert_rjs :page, "user-#{user_id}", :remove assert_equal @no_users_before-1, User.find(:all).size end