summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2025-04-18 14:41:26 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2025-04-18 14:41:26 +0000
commit9cd696c72b23b35bf93356d24785c7bd54e75111 (patch)
tree4f1b3859c84bb94ae044f1f010df777b7aef5ef5
parentcd3cc7eae9c377f6f3519571f45e268426689644 (diff)
downloadredmine-9cd696c72b23b35bf93356d24785c7bd54e75111.tar.gz
redmine-9cd696c72b23b35bf93356d24785c7bd54e75111.zip
Merged r23672 and r23675 from trunk to 5.1-stable (#42545).
git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@23677 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--test/fixtures/changesets.yml12
-rw-r--r--test/functional/issues_controller_test.rb16
-rw-r--r--test/functional/search_controller_test.rb10
-rw-r--r--test/unit/changeset_test.rb2
-rw-r--r--test/unit/repository_test.rb10
6 files changed, 41 insertions, 11 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 377765cbb..234a12921 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -402,7 +402,7 @@ module ApplicationHelper
def format_changeset_comments(changeset, options={})
method = options[:short] ? :short_comments : :comments
- textilizable changeset, method, :formatting => Setting.commit_logs_formatting?
+ textilizable changeset, method, project: changeset.project, formatting: Setting.commit_logs_formatting?
end
def due_date_distance_in_words(date)
diff --git a/test/fixtures/changesets.yml b/test/fixtures/changesets.yml
index 247dda375..8eaca6788 100644
--- a/test/fixtures/changesets.yml
+++ b/test/fixtures/changesets.yml
@@ -102,3 +102,15 @@ changesets_010:
user_id: 3
repository_id: 10
committer: dlopper
+changesets_011:
+ commit_date: "2025-04-07"
+ comments: |-
+ This commit references an issue and a [[wiki]] page
+ Refs #2
+ committed_on: 2025-04-07 19:00:00
+ revision: "11"
+ id: 110
+ scmid:
+ user_id: 3
+ repository_id: 10
+ committer: dlopper
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 0c687d90d..4a6084f26 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -3164,6 +3164,22 @@ class IssuesControllerTest < Redmine::ControllerTest
end
end
+ def test_show_render_changeset_comments_in_original_context
+ issue = Issue.find(9)
+ issue.changeset_ids = [110]
+ issue.save!
+
+ @request.session[:user_id] = 2
+ get :issue_tab, params: {id: issue.id, name: 'changesets', format: 'js'}, xhr: true
+
+ assert_select 'div#changeset-110' do
+ # assert_select 'div.tabs a[id=?]', 'tab-changesets', text: 'unicorns'
+ assert_select 'div.changeset-comments' do
+ assert_select 'a[href=?]', '/projects/ecookbook/wiki/Wiki', text: 'wiki'
+ end
+ end
+ end
+
def test_show_should_display_spent_time_tab_for_issue_with_time_entries
@request.session[:user_id] = 1
get :show, :params => {:id => 3}
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb
index 2cb785d70..04ec5a05d 100644
--- a/test/functional/search_controller_test.rb
+++ b/test/functional/search_controller_test.rb
@@ -66,16 +66,18 @@ class SearchControllerTest < Redmine::ControllerTest
assert_response :success
assert_select '#search-results' do
- assert_select 'dt.issue a', :text => /Feature request #2/
+ assert_select 'dt.issue a', :text => /Bug #1/
assert_select 'dt.issue a', :text => /Bug #5/
assert_select 'dt.changeset a', :text => /Revision 1/
- assert_select 'dt.issue a', :text => /Add ingredients categories/
- assert_select 'dd', :text => /should be classified by categories/
+ assert_select 'dt.issue a', :text => /Cannot print recipes/
+ assert_select 'dd', :text => /Unable to print/
end
assert_select '#search-results-counts' do
- assert_select 'a', :text => 'Changesets (5)'
+ assert_select 'a', :text => 'Changesets (6)'
+ assert_select 'a', :text => 'Issues (5)'
+ assert_select 'a', :text => 'Projects (4)'
end
end
diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb
index 3eac9ba8f..dff6459b4 100644
--- a/test/unit/changeset_test.rb
+++ b/test/unit/changeset_test.rb
@@ -479,7 +479,7 @@ class ChangesetTest < ActiveSupport::TestCase
end
def test_next_nil
- changeset = Changeset.find_by_revision('10')
+ changeset = Changeset.find_by_revision('11')
assert_nil changeset.next
end
diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb
index a02e30271..d847e1f64 100644
--- a/test/unit/repository_test.rb
+++ b/test/unit/repository_test.rb
@@ -455,7 +455,7 @@ class RepositoryTest < ActiveSupport::TestCase
def test_stats_by_author_reflect_changesets_and_changes
repository = Repository.find(10)
- expected = {"Dave Lopper"=>{:commits_count=>10, :changes_count=>3}}
+ expected = {"Dave Lopper"=>{:commits_count=>11, :changes_count=>3}}
assert_equal expected, repository.stats_by_author
set = Changeset.create!(
@@ -467,7 +467,7 @@ class RepositoryTest < ActiveSupport::TestCase
)
Change.create!(:changeset => set, :action => 'A', :path => '/path/to/file1')
Change.create!(:changeset => set, :action => 'A', :path => '/path/to/file2')
- expected = {"Dave Lopper"=>{:commits_count=>11, :changes_count=>5}}
+ expected = {"Dave Lopper"=>{:commits_count=>12, :changes_count=>5}}
assert_equal expected, repository.stats_by_author
end
@@ -476,7 +476,7 @@ class RepositoryTest < ActiveSupport::TestCase
# to ensure things are dynamically linked to Users
User.find_by_login("dlopper").update_attribute(:firstname, "Dave's")
repository = Repository.find(10)
- expected = {"Dave's Lopper"=>{:commits_count=>10, :changes_count=>3}}
+ expected = {"Dave's Lopper"=>{:commits_count=>11, :changes_count=>3}}
assert_equal expected, repository.stats_by_author
end
@@ -502,7 +502,7 @@ class RepositoryTest < ActiveSupport::TestCase
# with committer="dlopper <dlopper@somefoo.net>"
repository = Repository.find(10)
- expected = {"Dave Lopper"=>{:commits_count=>10, :changes_count=>3}}
+ expected = {"Dave Lopper"=>{:commits_count=>11, :changes_count=>3}}
assert_equal expected, repository.stats_by_author
set = Changeset.create!(
@@ -513,7 +513,7 @@ class RepositoryTest < ActiveSupport::TestCase
:comments => 'Another commit by foo.'
)
- expected = {"Dave Lopper"=>{:commits_count=>11, :changes_count=>3}}
+ expected = {"Dave Lopper"=>{:commits_count=>12, :changes_count=>3}}
assert_equal expected, repository.stats_by_author
end