summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/helpers/application_helper.rb13
-rw-r--r--app/views/issues/_changesets.html.erb4
-rw-r--r--app/views/repositories/_changeset.html.erb4
-rw-r--r--app/views/repositories/_revisions.html.erb2
-rw-r--r--app/views/settings/_repositories.html.erb2
-rw-r--r--config/locales/en.yml1
-rw-r--r--config/locales/fr.yml1
-rw-r--r--config/settings.yml2
-rw-r--r--public/stylesheets/application.css1
-rw-r--r--test/functional/repositories_controller_test.rb10
10 files changed, 35 insertions, 5 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index d4bd6a2f2..e6078358d 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -254,6 +254,11 @@ module ApplicationHelper
end
end
+ def format_changeset_comments(changeset, options={})
+ method = options[:short] ? :short_comments : :comments
+ textilizable changeset, method, :formatting => Setting.commit_logs_formatting?
+ end
+
def due_date_distance_in_words(date)
if date
l((date < User.current.today ? :label_roadmap_overdue : :label_roadmap_due_in), distance_of_date_in_words(User.current.today, date))
@@ -619,7 +624,13 @@ module ApplicationHelper
text = text.dup
macros = catch_macros(text)
- text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text, :object => obj, :attribute => attr)
+
+ if options[:formatting] == false
+ text = h(text)
+ else
+ formatting = options[:formatting] || Setting.text_formatting
+ text = Redmine::WikiFormatting.to_html(formatting, text, :object => obj, :attribute => attr)
+ end
@parsed_headings = []
@heading_anchors = {}
diff --git a/app/views/issues/_changesets.html.erb b/app/views/issues/_changesets.html.erb
index f4b47c617..0e963fcf8 100644
--- a/app/views/issues/_changesets.html.erb
+++ b/app/views/issues/_changesets.html.erb
@@ -13,8 +13,8 @@
<% end %>
<br />
<span class="author"><%= authoring(changeset.committed_on, changeset.author) %></span></p>
- <div class="wiki">
- <%= textilizable(changeset, :comments) %>
+ <div class="wiki changset-comments">
+ <%= format_changeset_comments changeset %>
</div>
</div>
<% end %>
diff --git a/app/views/repositories/_changeset.html.erb b/app/views/repositories/_changeset.html.erb
index dbdf17160..e123daf86 100644
--- a/app/views/repositories/_changeset.html.erb
+++ b/app/views/repositories/_changeset.html.erb
@@ -33,7 +33,9 @@
</div>
-<%= textilizable @changeset.comments %>
+<div class="wiki changset-comments">
+ <%= format_changeset_comments @changeset %>
+</div>
<% if @changeset.issues.visible.any? || User.current.allowed_to?(:manage_related_issues, @repository.project) %>
<%= render :partial => 'related_issues' %>
diff --git a/app/views/repositories/_revisions.html.erb b/app/views/repositories/_revisions.html.erb
index 9c72204fa..d1b9c4b04 100644
--- a/app/views/repositories/_revisions.html.erb
+++ b/app/views/repositories/_revisions.html.erb
@@ -42,7 +42,7 @@ end %>
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').prop('checked')) {$('#cb-#{line_num-1}').prop('checked',true);}") if show_diff && (line_num > 1) %></td>
<td class="committed_on"><%= format_time(changeset.committed_on) %></td>
<td class="author"><%= changeset.user.blank? ? changeset.author.to_s.truncate(30) : link_to_user(changeset.user) %></td>
-<td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td>
+<td class="comments"><%= format_changeset_comments changeset, :short => true %></td>
</tr>
<% line_num += 1 %>
<% end %>
diff --git a/app/views/settings/_repositories.html.erb b/app/views/settings/_repositories.html.erb
index 760903ea0..adac52fc7 100644
--- a/app/views/settings/_repositories.html.erb
+++ b/app/views/settings/_repositories.html.erb
@@ -52,6 +52,8 @@
</p>
<p><%= setting_text_field :repository_log_display_limit, :size => 6 %></p>
+
+<p><%= setting_check_box :commit_logs_formatting %></p>
</div>
<fieldset class="box tabular settings">
diff --git a/config/locales/en.yml b/config/locales/en.yml
index e0ebe3bf1..ba839aa78 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -448,6 +448,7 @@ en:
setting_attachment_extensions_allowed: Allowed extensions
setting_attachment_extensions_denied: Disallowed extensions
setting_new_item_menu_tab: Project menu tab for creating new objects
+ setting_commit_logs_formatting: Apply text formatting to commit messages
permission_add_project: Create project
permission_add_subprojects: Create subprojects
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 69cc6b896..abf39c8e6 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -460,6 +460,7 @@ fr:
setting_sys_api_key: Clé de protection de l'API
setting_lost_password: Autoriser la réinitialisation par email de mot de passe perdu
setting_new_item_menu_tab: Onglet de création d'objets dans le menu du project
+ setting_commit_logs_formatting: Appliquer le formattage de texte aux messages de commit
permission_add_project: Créer un projet
permission_add_subprojects: Créer des sous-projets
diff --git a/config/settings.yml b/config/settings.yml
index b9a82583f..8dd8b3dc9 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -239,6 +239,8 @@ repositories_encodings:
# encoding used to convert commit logs to UTF-8
commit_logs_encoding:
default: 'UTF-8'
+commit_logs_formatting:
+ default: 1
repository_log_display_limit:
format: int
default: 100
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index bb2b0b888..ef4c7404c 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -492,6 +492,7 @@ div#issue-changesets {float:right; width:45%; margin-left: 1em; margin-bottom: 1
div#issue-changesets div.changeset { padding: 4px;}
div#issue-changesets div.changeset { border-bottom: 1px solid #ddd; }
div#issue-changesets p { margin-top: 0; margin-bottom: 1em;}
+.changset-comments {margin-bottom:1em; font-family:}
div.journal {overflow:auto;}
div.journal.private-notes {border-left:2px solid #d22; padding-left:4px; margin-left:-6px;}
diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb
index ebe6c0da8..0fc7cfa86 100644
--- a/test/functional/repositories_controller_test.rb
+++ b/test/functional/repositories_controller_test.rb
@@ -167,6 +167,16 @@ class RepositoriesControllerTest < Redmine::ControllerTest
assert_select 'h2', :text => 'Revision 1'
end
+ def test_revision_should_not_format_comments_when_disabled
+ Changeset.where(:id => 100).update_all(:comments => 'Simple *text*')
+
+ with_settings :commit_logs_formatting => '0' do
+ get :revision, :id => 1, :rev => 1
+ assert_response :success
+ assert_select '.changset-comments', :text => 'Simple *text*'
+ end
+ end
+
def test_revision_should_show_add_related_issue_form
Role.find(1).add_permission! :manage_related_issues
@request.session[:user_id] = 2