From 24d957cb3276d44a9d1da9ced39dcde5c830947a Mon Sep 17 00:00:00 2001
From: maxwell <maxwell@joindiaspora.com>
Date: Mon, 13 Sep 2010 12:20:47 -0700
Subject: [PATCH] MS IZ removed the views and redirected the edit route

---
 app/controllers/albums_controller.rb | 1 +
 app/controllers/photos_controller.rb | 2 ++
 app/views/aspects/show.html.haml     | 2 +-
 app/views/photos/show.html.haml      | 3 ++-
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb
index dd7c417e3c..c946f7508e 100644
--- a/app/controllers/albums_controller.rb
+++ b/app/controllers/albums_controller.rb
@@ -34,6 +34,7 @@ class AlbumsController < ApplicationController
 
   def edit
     @album = Album.find_by_id params[:id]
+    redirect_to @album unless current_user.owns? @album
   end
 
   def update
diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb
index 3c0fe4b4e4..b684c986d9 100644
--- a/app/controllers/photos_controller.rb
+++ b/app/controllers/photos_controller.rb
@@ -71,6 +71,8 @@ class PhotosController < ApplicationController
   def edit
     @photo = Photo.find_by_id params[:id]
     @album = @photo.album
+
+    redirect_to @photo unless current_user.owns? @album
   end
 
   def update
diff --git a/app/views/aspects/show.html.haml b/app/views/aspects/show.html.haml
index 5925354f0e..aea12cfe5a 100644
--- a/app/views/aspects/show.html.haml
+++ b/app/views/aspects/show.html.haml
@@ -6,7 +6,7 @@
 
 %ul#stream
   - for post in @posts
-    = render type_partial(post), :post => post
+    = render type_partial(post), :post => post unless post.class == Album
 #pagination
   = will_paginate @posts
 
diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml
index cbe3505f94..37ccdcc9e4 100644
--- a/app/views/photos/show.html.haml
+++ b/app/views/photos/show.html.haml
@@ -21,7 +21,8 @@
   = @photo.image
 
   .right
-    = link_to 'Edit Photo', edit_photo_path(@photo), :class => "button"
+    -if current_user.owns? @album
+      = link_to 'Edit Photo', edit_photo_path(@photo), :class => "button"
 
 .sub_header
   = link_to "<< prev", url_to_prev(@photo, @album)
-- 
GitLab