<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -6,6 +6,7 @@ class ApplicationController &lt; ActionController::Base
   filter_parameter_logging :password
   layout 'isitruby19'
   include ReCaptcha::AppHelper
+  helper_method :my_comments
   
 protected
   # build an rss feed for the given collection
@@ -29,4 +30,11 @@ protected
       end
     end.to_s
   end
+
+  # uses the session to store which comments I created  
+  def my_comments
+    session[:my_comments] ||= []
+  end
+
+
 end</diff>
      <filename>app/controllers/application.rb</filename>
    </modified>
    <modified>
      <diff>@@ -57,10 +57,6 @@ class CommentsController &lt; ApplicationController
   end
 
 private
-  def my_comments
-    session[:my_comments] ||= []
-  end
-
   def captcha_is_valid_for comment, options 
     return true if ENV['RAILS_ENV'] == 'test' # captcha is always valid in test mode
     return validate_recap(options[:with], comment.errors, :rcc_pub =&gt; RECAPTCHA_PUBLIC_KEY, :rcc_priv =&gt; RECAPTCHA_PRIVATE_KEY)  </diff>
      <filename>app/controllers/comments_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,9 @@ module CommentsHelper
   end
   
   def delete_link_for comment
-    link_to &quot;DELETE&quot;, comment_path(comment), :method =&gt; :delete, :class =&gt; 'delete-comment' unless comment.new_record?
+    return nil if comment.new_record?
+    return nil unless my_comments.include?(comment.id)
+    link_to &quot;DELETE&quot;, comment_path(comment), :method =&gt; :delete, :class =&gt; 'delete-comment', :confirm =&gt; 'Are you sure?'
   end
   
   def opinion_for comment</diff>
      <filename>app/helpers/comments_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -26,4 +26,11 @@ Feature: adding a comment
     When I click the delete comment link
     Then I do not see my comment on the page
   
-  Scenario: viewing someone else's comment 
\ No newline at end of file
+  Scenario: viewing someone else's comment 
+    
+    Given an initialised database
+    And a gem called &quot;rubynuts&quot;
+    And a comment against &quot;rubynuts&quot;
+    
+    When I visit the page for &quot;rubynuts&quot;
+    Then I do not see the delete comment link
\ No newline at end of file</diff>
      <filename>features/adding-a-comment.feature</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,9 @@
+Given /^a comment against &quot;(.*)&quot;$/ do | name | 
+  code = Code.find_by_name! name
+  comment = a_saved Comment, :code =&gt; code
+end
+
+
 Then /^I see the comment form$/ do
   response.should have_tag('div#new-comment-form')
 end
@@ -24,6 +30,11 @@ Then /^I see the delete comment link$/ do
   response.should have_tag('a.delete-comment')
 end
 
+Then /^I do not see the delete comment link$/ do
+  response.should_not have_tag('a.delete-comment')
+end
+
+
 Then /^I do not see my comment on the page$/ do
   response.should_not include_text('Here is my test comment')
 end</diff>
      <filename>features/step_definitions/comment_steps.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,11 @@
 def prepare_object_factory
   when_creating_a Code, :auto_generate =&gt; :name
   
+  when_creating_a Comment, 
+    :auto_generate =&gt; :name, 
+    :generate_email_address =&gt; :email, 
+    :generate =&gt; { 
+      :code =&gt; lambda { a_saved Code }, 
+      :platform =&gt; lambda { Platform.first }
+    }
 end
\ No newline at end of file</diff>
      <filename>lib/object_factory_config.rb</filename>
    </modified>
    <modified>
      <diff>@@ -279,6 +279,14 @@ div.errorExplanation {
 	margin-bottom: 10px;
 }
 
+#flash_error {
+	border: 1px solid red;
+	background-color: #CC0000;
+	padding: 10px;
+	margin-bottom: 10px;
+}
+
+
 dt {
 	color: #95ABC3;
 }</diff>
      <filename>public/stylesheets/styles.css</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f8f8c5873b240614f9c700e70fffa2b049edc54a</id>
    </parent>
  </parents>
  <author>
    <name>Rahoul Baruah</name>
    <email>rahoul@brightbox.co.uk</email>
  </author>
  <url>http://github.com/brightbox/isitruby19/commit/8e0d2577cfd86bd9099dd30b0b0ce47ba4eb6338</url>
  <id>8e0d2577cfd86bd9099dd30b0b0ce47ba4eb6338</id>
  <committed-date>2009-02-09T04:22:44-08:00</committed-date>
  <authored-date>2009-02-09T04:22:44-08:00</authored-date>
  <message>only shows the delete link if you have permission to delete</message>
  <tree>104b8949c70961c1391d5fb49468d6caf15c8e09</tree>
  <committer>
    <name>Rahoul Baruah</name>
    <email>rahoul@brightbox.co.uk</email>
  </committer>
</commit>
