From: Jean-Philippe Lang
Date: Mon, 12 Dec 2016 21:19:59 +0000 (+0000)
Subject: Adds a setting to enable/disable formatting of commit messages (#22758).
X-Git-Tag: 3.4.0~514
X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ba2a47a8fb755a88914702d129bb6a727e45691a;p=redmine.git
Adds a setting to enable/disable formatting of commit messages (#22758).
git-svn-id: http://svn.redmine.org/redmine/trunk@16062 e93f8b46-1217-0410-a6f0-8f06a7374b81
---
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 %>
<%= authoring(changeset.committed_on, changeset.author) %>
-
- <%= textilizable(changeset, :comments) %>
+
<% 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 @@
-<%= textilizable @changeset.comments %>
+
<% 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 %>
<%= 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) %> |
<%= format_time(changeset.committed_on) %> |
<%= changeset.user.blank? ? changeset.author.to_s.truncate(30) : link_to_user(changeset.user) %> |
-
+
<% 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 @@
<%= setting_text_field :repository_log_display_limit, :size => 6 %>
+
+<%= setting_check_box :commit_logs_formatting %>