<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,7 +3,9 @@ topics_only = defined?(topics_only) ? topics_only : false
 
 # These queries uses zoom and aren't cached
 @total_item_counts = 0
-@content_relations_count = ContentItemRelation.count(:conditions =&gt; { :topic_id =&gt; @cache_id })
+conditions = &quot;content_item_relations.related_item_id = :cache_id&quot;
+conditions = &quot;content_item_relations.topic_id = :cache_id OR #{conditions}&quot; if params[:controller] == 'topics'
+@content_relations_count = ContentItemRelation.count(:conditions =&gt; [conditions, { :cache_id =&gt; @cache_id }])
 if @content_relations_count &gt; 0
   @public_item_counts = public_related_items_for(item, { :topics_only =&gt; topics_only, :count_only =&gt; true })
   @private_item_counts = private_related_items_for(item, { :topics_only =&gt; topics_only, :count_only =&gt; true })
@@ -42,18 +44,18 @@ end
   &lt;% if current_user_can_see_add_links? -%&gt;
     &lt;div id=&quot;related-items-tools&quot;&gt;
       &lt;ul&gt;
-        &lt;% cache({ :part =&gt; 'related-tools-create-or-link-or-remove', :id =&gt; @cache_id }) do -%&gt;
+        &lt;% cache({ :related =&gt; 'related-tools-create-or-link-or-remove', :id =&gt; @cache_id }) do -%&gt;
           &lt;%= header_add_links(:relate_to_topic =&gt; item, :link_text =&gt; 'Create', :class =&gt; 'first') -%&gt;
           &lt;%= link_to_related_item_function(:link_text =&gt; 'Link Existing', :function =&gt; 'add', :relate_to_topic =&gt; item) -%&gt;
           &lt;%= link_to_related_item_function(:link_text =&gt; 'Remove', :function =&gt; 'remove', :relate_to_topic =&gt; item) -%&gt;
         &lt;% end -%&gt;
         &lt;% if @basket_moderator -%&gt;
-          &lt;% cache({ :part =&gt; 'related-tools-restore', :id =&gt; @cache_id }) do -%&gt;
+          &lt;% cache({ :related =&gt; 'related-tools-restore', :id =&gt; @cache_id }) do -%&gt;
             &lt;%= link_to_related_item_function(:link_text =&gt; 'Restore', :function =&gt; 'restore', :relate_to_topic =&gt; item) -%&gt;
           &lt;% end -%&gt;
         &lt;% end -%&gt;
         &lt;% if @site_admin -%&gt;
-          &lt;% cache({ :part =&gt; 'related-tools-import', :id =&gt; @cache_id }) do -%&gt;
+          &lt;% cache({ :related =&gt; 'related-tools-import', :id =&gt; @cache_id }) do -%&gt;
             &lt;%= link_to_add_set_of_related_items(:link_text =&gt; 'Import Set', :relate_to_topic =&gt; item) -%&gt;
           &lt;% end -%&gt;
         &lt;% end -%&gt;</diff>
      <filename>app/views/topics/_related_items.html.erb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1ea90625cc35b740bfa6660ef41af2aded950b66</id>
    </parent>
  </parents>
  <author>
    <name>Kieran Pilkington</name>
    <email>kieran@katipo.co.nz</email>
  </author>
  <url>http://github.com/kete/kete/commit/834be8e35d9b12363e67bbd10c62969b286f2ab1</url>
  <id>834be8e35d9b12363e67bbd10c62969b286f2ab1</id>
  <committed-date>2009-01-27T22:51:19-08:00</committed-date>
  <authored-date>2009-01-27T22:51:19-08:00</authored-date>
  <message>bugfix: fixing an issue with related items not showing up (incorrect query). Also fixing issue where tool link caches weren't being cleared.</message>
  <tree>6391df5224f45d31d06486ab887b91b2c75a47b9</tree>
  <committer>
    <name>Kieran Pilkington</name>
    <email>kieran@katipo.co.nz</email>
  </committer>
</commit>
