diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index 99f7bcf..2abda90 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -40,7 +40,7 @@ class SettingsController < ApplicationController @options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] } @deliveries = ActionMailer::Base.perform_deliveries - @guessed_host_and_path = request.host_with_port + @guessed_host_and_path = request.host_with_port.dup @guessed_host_and_path << ('/'+ request.relative_url_root.gsub(%r{^\/}, '')) unless request.relative_url_root.blank? end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 35d1670..c1acc5e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -291,16 +291,15 @@ module ApplicationHelper attachments = attachments.sort_by(&:created_on).reverse text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(bmp|gif|jpg|jpeg|png))!/i) do |m| style = $1 - filename = $6 - rf = Regexp.new(Regexp.escape(filename), Regexp::IGNORECASE) + filename = $6.downcase # search for the picture in attachments - if found = attachments.detect { |att| att.filename =~ rf } + if found = attachments.detect { |att| att.filename.downcase == filename } image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found desc = found.description.to_s.gsub(/^([^\(\)]*).*$/, "\\1") alt = desc.blank? ? nil : "(#{desc})" "!#{style}#{image_url}#{alt}!" else - "!#{style}#{filename}!" + m end end end diff --git a/app/models/message.rb b/app/models/message.rb index 080e757..716c53b 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -23,7 +23,7 @@ class Message < ActiveRecord::Base belongs_to :last_reply, :class_name => 'Message', :foreign_key => 'last_reply_id' acts_as_searchable :columns => ['subject', 'content'], - :include => {:board, :project}, + :include => {:board => :project}, :project_key => 'project_id', :date_column => "#{table_name}.created_on" acts_as_event :title => Proc.new {|o| "#{o.board.name}: #{o.subject}"}, diff --git a/app/models/role.rb b/app/models/role.rb index beb13c0..b07e7a0 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -31,9 +31,9 @@ class Role < ActiveRecord::Base raise "Can not copy workflow from a #{role.class}" unless role.is_a?(Role) raise "Can not copy workflow from/to an unsaved role" if proxy_owner.new_record? || role.new_record? clear - connection.insert "INSERT INTO workflows (tracker_id, old_status_id, new_status_id, role_id)" + + connection.insert "INSERT INTO #{Workflow.table_name} (tracker_id, old_status_id, new_status_id, role_id)" + " SELECT tracker_id, old_status_id, new_status_id, #{proxy_owner.id}" + - " FROM workflows" + + " FROM #{Workflow.table_name}" + " WHERE role_id = #{role.id}" end end diff --git a/app/models/tracker.rb b/app/models/tracker.rb index ecee908..7c5bae2 100644 --- a/app/models/tracker.rb +++ b/app/models/tracker.rb @@ -23,9 +23,9 @@ class Tracker < ActiveRecord::Base raise "Can not copy workflow from a #{tracker.class}" unless tracker.is_a?(Tracker) raise "Can not copy workflow from/to an unsaved tracker" if proxy_owner.new_record? || tracker.new_record? clear - connection.insert "INSERT INTO workflows (tracker_id, old_status_id, new_status_id, role_id)" + + connection.insert "INSERT INTO #{Workflow.table_name} (tracker_id, old_status_id, new_status_id, role_id)" + " SELECT #{proxy_owner.id}, old_status_id, new_status_id, role_id" + - " FROM workflows" + + " FROM #{Workflow.table_name}" + " WHERE tracker_id = #{tracker.id}" end end diff --git a/app/views/issues/_form.rhtml b/app/views/issues/_form.rhtml index 0ca1255..b447190 100644 --- a/app/views/issues/_form.rhtml +++ b/app/views/issues/_form.rhtml @@ -24,11 +24,13 @@

<%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %>

<%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %>

+<% unless @project.issue_categories.empty? %>

<%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %> <%= prompt_to_remote(l(:label_issue_category_new), l(:label_issue_category_new), 'category[name]', {:controller => 'projects', :action => 'add_issue_category', :id => @project}, :class => 'small', :tabindex => 199) if authorize_for('projects', 'add_issue_category') %>

+<% end %> <%= content_tag('p', f.select(:fixed_version_id, (@project.versions.sort.collect {|v| [v.name, v.id]}), { :include_blank => true })) unless @project.versions.empty? %> diff --git a/app/views/issues/bulk_edit.rhtml b/app/views/issues/bulk_edit.rhtml index b916cf0..01e4e2e 100644 --- a/app/views/issues/bulk_edit.rhtml +++ b/app/views/issues/bulk_edit.rhtml @@ -44,6 +44,7 @@
<%= l(:field_notes) %> <%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %> <%= wikitoolbar_for 'notes' %> +

<%= submit_tag l(:button_submit) %> diff --git a/app/views/my/blocks/_timelog.rhtml b/app/views/my/blocks/_timelog.rhtml index a3f74e5..ca66f7e 100644 --- a/app/views/my/blocks/_timelog.rhtml +++ b/app/views/my/blocks/_timelog.rhtml @@ -47,6 +47,6 @@ entries_by_day = entries.group_by(&:spent_on) <% end -%> <% end -%> - + <% end %> diff --git a/app/views/projects/settings/_versions.rhtml b/app/views/projects/settings/_versions.rhtml index 7329c7f..79d92d8 100644 --- a/app/views/projects/settings/_versions.rhtml +++ b/app/views/projects/settings/_versions.rhtml @@ -17,7 +17,6 @@ <%= link_to(version.wiki_page_title, :controller => 'wiki', :page => Wiki.titleize(version.wiki_page_title)) unless version.wiki_page_title.blank? || @project.wiki.nil? %> <%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %> <%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> - <% end; reset_cycle %> diff --git a/app/views/wiki/export.rhtml b/app/views/wiki/export.rhtml index 94b4e6f..7f861fa 100644 --- a/app/views/wiki/export.rhtml +++ b/app/views/wiki/export.rhtml @@ -5,7 +5,7 @@ diff --git a/db/migrate/098_set_topic_authors_as_watchers.rb b/db/migrate/098_set_topic_authors_as_watchers.rb index 5bc41fb..92a53f4 100644 --- a/db/migrate/098_set_topic_authors_as_watchers.rb +++ b/db/migrate/098_set_topic_authors_as_watchers.rb @@ -2,9 +2,10 @@ class SetTopicAuthorsAsWatchers < ActiveRecord::Migration def self.up # Sets active users who created/replied a topic as watchers of the topic # so that the new watch functionality at topic level doesn't affect notifications behaviour - Message.connection.execute("INSERT INTO watchers (watchable_type, watchable_id, user_id)" + - " SELECT DISTINCT 'Message', COALESCE(messages.parent_id, messages.id), messages.author_id FROM messages, users" + - " WHERE messages.author_id = users.id AND users.status = 1") + Message.connection.execute("INSERT INTO #{Watcher.table_name} (watchable_type, watchable_id, user_id)" + + " SELECT DISTINCT 'Message', COALESCE(m.parent_id, m.id), m.author_id" + + " FROM #{Message.table_name} m, #{User.table_name} u" + + " WHERE m.author_id = u.id AND u.status = 1") end def self.down diff --git a/lib/redcloth3.rb b/lib/redcloth3.rb index c138450..9e63bf5 100644 --- a/lib/redcloth3.rb +++ b/lib/redcloth3.rb @@ -792,7 +792,7 @@ class RedCloth3 < String (?:\(([^)]+?)\)(?="))? # $title ": ( # $url - (\/|https?:\/\/|s?ftps?:\/\/|www\.) + (\/|[a-zA-Z]+:\/\/|www\.) # $proto [\w\/]\S+? ) (\/)? # $slash diff --git a/public/help/wiki_syntax_detailed.html b/public/help/wiki_syntax_detailed.html index 581da85..b3db673 100644 --- a/public/help/wiki_syntax_detailed.html +++ b/public/help/wiki_syntax_detailed.html @@ -61,7 +61,7 @@

Wiki links are displayed in red if the page doesn't exist yet, eg: Nonexistent page.

diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 5f1a589..03a4db3 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -89,7 +89,9 @@ class ApplicationHelperTest < HelperTestCase def test_attached_images to_test = { 'Inline image: !logo.gif!' => 'Inline image: This is a logo', - 'Inline image: !logo.GIF!' => 'Inline image: This is a logo' + 'Inline image: !logo.GIF!' => 'Inline image: This is a logo', + 'No match: !ogo.gif!' => 'No match: ', + 'No match: !ogo.GIF!' => 'No match: ' } attachments = Attachment.find(:all) to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text, :attachments => attachments) }