Defect #6435

Links to wikipages bound to versions do not respect version-sharing in Settings -> Versions

Added by Mischa The Evil about 11 years ago. Updated almost 11 years ago.

Status:ClosedStart date:2010-09-20
Priority:NormalDue date:
Assignee:Mischa The Evil% Done:


Target version:1.0.3
Resolution:Fixed Affected version:


While reviewing the implementation for issue #4416 I noticed that the links to wikipages bound to versions do not respect version-sharing (introduced in r3123 for issue #465 and enhanced with r3133 for issue #4357) in Settings -> Versions.

This leads to incorrect links when the version does not belong to the current project. More specifically, the links always point to the current project wiki instead of the wiki of the actual versions project.

Another side-effect is that in the unless-statement again only the current project wiki is checked for existence instead of the actual versions project wiki.

6435-fix_links_to_wikipages_with_version-sharing.diff Magnifier - Patch against trunk at r4101. (2.07 KB) Mischa The Evil, 2010-09-20 05:44

Related issues

Related to Redmine - Feature #4416: Link from version details page to edit the wiki. Closed 2009-12-16

Associated revisions

Revision 4307
Added by Jean-Baptiste Barth almost 11 years ago

Fix wikilinks in project > settings > versions and version view. #6435 #4416

Contributed by Mischa The Evil and Felix Schäfer.


#1 Updated by Mischa The Evil about 11 years ago

I've fixed this by wrapping source:/trunk/app/views/projects/settings/_versions.rhtml#L20 into a basic if-else structure (checking for version.project == @project) and adding a modified else-case statement (added :id-param containing version.project-value and changed unless statement to check instead of

Here follows my patch (which also "fixes" two coding-standard inconsistencies (my third and fourth change)) which I'll attach seperately also:

Index: app/views/projects/settings/_versions.rhtml
--- app/views/projects/settings/_versions.rhtml    (revision 4101)
+++ app/views/projects/settings/_versions.rhtml    (working copy)
@@ -6,7 +6,7 @@
     <th><%= l(:field_description) %></th>
     <th><%= l(:field_status) %></th>
     <th><%= l(:field_sharing) %></th>
-    <th><%= l(:label_wiki_page) unless %></th>
+    <th><%= l(:label_wiki_page) %></th>
     <th style="width:15%"></th>
@@ -17,13 +17,19 @@
     <td class="description"><%=h version.description %></td>
     <td class="status"><%= l("version_status_#{version.status}") %></td>
     <td class="sharing"><%=h format_version_sharing(version.sharing) %></td>
-    <td><%= link_to(h(version.wiki_page_title), :controller => 'wiki', :page => Wiki.titleize(version.wiki_page_title)) unless version.wiki_page_title.blank? || %></td>
+    <td>
+        <% if version.project == @project %>
+            <%= link_to(h(version.wiki_page_title), :controller => 'wiki', :page => Wiki.titleize(version.wiki_page_title)) unless version.wiki_page_title.blank? || %>
+        <% else %>
+            <%= link_to(h(version.wiki_page_title), :controller => 'wiki', :id => version.project, :page => Wiki.titleize(version.wiki_page_title)) unless version.wiki_page_title.blank? || %>
+        <% end %>
+    </td>
     <td class="buttons">
         <% if version.project == @project %>
-            <%= link_to_if_authorized l(:button_edit),   {:controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %>
+            <%= 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 => :delete, :class => 'icon icon-del' %>
         <% end %>
-       </td>
+    </td>
 <% end; reset_cycle %>

As visible from my 1st change it is required in Redmine now to always show the Wikipage heading because of that it is possible that inherited versions contain bound wikipages while the current projects wiki does not exist.

#2 Updated by Mischa The Evil about 11 years ago

Added relation to issue #4416 cause of its similarity regarding the scoping of links (started by Jean-Baptiste Barth in note-6).

#3 Updated by Eric Davis about 11 years ago

  • Category changed from Projects to Roadmap
  • Target version set to 1.0.3

#4 Updated by Felix Schäfer about 11 years ago

Included in a fix for #4416, I didn't take the if-block though, as it seems superfluous.

#5 Updated by Jean-Baptiste Barth almost 11 years ago

  • Status changed from New to Resolved
  • Assignee set to Mischa The Evil
  • % Done changed from 0 to 100
  • Resolution set to Fixed

Fix applied in r4307, thanks Mischa & Felix.

#6 Updated by Eric Davis almost 11 years ago

  • Status changed from Resolved to Closed

Merged into 1.0-stable for release in 1.0.3

Also available in: Atom PDF