Project

General

Profile

Actions

Defect #32529

closed

The end of the URL is replaced with "undefined" in IE11 and Edge

Added by Yuichi HARADA over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Clicking "Administration > Users > [dlopper]" redirects to "/users/3/edit", however address bar shows "/users/3/undefined".

Reproduce with trunk and 4.1-stable. (Does not reproduce with 4.0-stable)

Maybe this.href added to #3058 doesn't seem to work on IE11 and Edge.
I confirmed that the following patch works with IE11, Edge, Firefox, Chrome, Safari.

diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ab4849957..1ad81b216 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -452,7 +452,7 @@ module ApplicationHelper
     if tab[:onclick]
       return tab[:onclick]
     elsif tab[:partial]
-      return "showTab('#{tab[:name]}', this.href)" 
+      return "showTab('#{tab[:name]}', location.href)" 
     else
       return nil
     end
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 2ea81d566..3d2a0041b 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -615,9 +615,9 @@ module IssuesHelper
       journals_without_notes = @journals.select{|value| value.notes.blank?}
       journals_with_notes = @journals.reject{|value| value.notes.blank?}

-      tabs << {:name => 'history', :label => :label_history, :onclick => 'showIssueHistory("history", this.href)', :partial => 'issues/tabs/history', :locals => {:issue => @issue, :journals => @journals}}
-      tabs << {:name => 'notes', :label => :label_issue_history_notes, :onclick => 'showIssueHistory("notes", this.href)'} if journals_with_notes.any?
-      tabs << {:name => 'properties', :label => :label_issue_history_properties, :onclick => 'showIssueHistory("properties", this.href)'} if journals_without_notes.any?
+      tabs << {:name => 'history', :label => :label_history, :onclick => 'showIssueHistory("history", location.href)', :partial => 'issues/tabs/history', :locals => {:issue => @issue, :journals => @journals}}
+      tabs << {:name => 'notes', :label => :label_issue_history_notes, :onclick => 'showIssueHistory("notes", location.href)'} if journals_with_notes.any?
+      tabs << {:name => 'properties', :label => :label_issue_history_properties, :onclick => 'showIssueHistory("properties", location.href)'} if journals_without_notes.any?
     end
     tabs << {:name => 'time_entries', :label => :label_time_entry_plural, :remote => true, :onclick => "getRemoteTab('time_entries', '#{tab_issue_path(@issue, :name => 'time_entries')}', '#{issue_path(@issue, :tab => 'time_entries')}')"} if User.current.allowed_to?(:view_time_entries, @project) && @issue.spent_hours > 0
     tabs << {:name => 'changesets', :label => :label_associated_revisions, :remote => true, :onclick => "getRemoteTab('changesets', '#{tab_issue_path(@issue, :name => 'changesets')}', '#{issue_path(@issue, :tab => 'changesets')}')"} if @has_changesets

Files

url_changed_to_undefined.png (39 KB) url_changed_to_undefined.png Yuichi HARADA, 2019-11-29 04:03

Related issues

Related to Redmine - Feature #3058: Show issue history using tabsClosedJean-Philippe Lang2009-03-26

Actions
Actions #1

Updated by Go MAEDA over 4 years ago

Actions #2

Updated by Go MAEDA over 4 years ago

  • Assignee set to Marius BĂLTEANU

Marius, could you review this fix?

Actions #3

Updated by Marius BĂLTEANU over 4 years ago

Go MAEDA wrote:

Marius, could you review this fix?

Yea, I’ll do it as soon I can.

Actions #4

Updated by Marius BĂLTEANU over 4 years ago

  • Assignee changed from Marius BĂLTEANU to Go MAEDA

Sorry for my late reply, please apply the below fix for now:

mariusbalteanu@Mariuss-MacBook-Pro redmine % git diff  
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index e125e68b4..e4e902d9c 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -412,7 +412,7 @@ function getRemoteTab(name, remote_url, url, load_always) {
 //replaces current URL with the "href" attribute of the current link
 //(only triggered if supported by browser)
 function replaceInHistory(url) {
-  if ("replaceState" in window.history) {
+  if ("replaceState" in window.history && url !== undefined) {
     window.history.replaceState(null, document.title, url);
   }
 }
Actions #5

Updated by Yuichi HARADA over 4 years ago

Marius BALTEANU wrote:

Sorry for my late reply, please apply the below fix for now:

[...]

Marius, I confirmed that "undefined" is not displayed using IE11 and Edge. Thank you for fixing the issue.

Actions #6

Updated by Jean-Philippe Lang over 4 years ago

  • Status changed from New to Closed
  • Assignee deleted (Go MAEDA)
  • Resolution set to Fixed

Committed, thanks.

Actions

Also available in: Atom PDF