From 5ef32b7d55947f745256d98658f717da3f91297c Mon Sep 17 00:00:00 2001 From: danielvincent Date: Wed, 22 Sep 2010 12:03:25 -0700 Subject: [PATCH] DG IZ; a user can repost. aspects are not sent through the websocket. post does not show where it curently is going in its partial --- app/controllers/application_controller.rb | 9 +++++++++ app/views/status_messages/_status_message.html.haml | 6 ++++++ config/routes.rb | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f0ca5bfc8..ac0d11b1c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -37,4 +37,13 @@ class ApplicationController < ActionController::Base @request_count = Request.for_user(current_user).size if current_user end + def repost + @post = current_user.find_visible_post_by_id params[:id] + if current_user.repost( @post, :to => params[:aspect_ids] ) + flash[:notice] = "Item re-shared." + else + flash[:error] = "Failed to re-share." + end + end + end diff --git a/app/views/status_messages/_status_message.html.haml b/app/views/status_messages/_status_message.html.haml index dcee761d1..ee484f47b 100644 --- a/app/views/status_messages/_status_message.html.haml +++ b/app/views/status_messages/_status_message.html.haml @@ -22,3 +22,9 @@ - if current_user.owns?(post) .destroy_link = link_to 'Delete', status_message_path(post), :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "delete" + + %b reshare: + -if @aspects + - for aspect in @aspects + = link_to aspect, repost_path( :id => post.id, :aspect_ids => aspect.id ) + diff --git a/config/routes.rb b/config/routes.rb index ae757499c..1a7a53925 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,12 +7,14 @@ Diaspora::Application.routes.draw do resources :people, :only => [:index, :show, :destroy] resources :users, :except => [:create, :new, :show] - resources :status_messages, :only => [:create, :destroy, :show] + resources :status_messages resources :comments, :except => [:index] resources :requests, :except => [:edit, :update] resources :photos, :except => [:index] resources :albums + match 'repost', :to => 'application#repost', :as => 'repost' + match 'aspects/move_friends', :to => 'aspects#move_friends', :as => 'move_friends' match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend' match 'aspects/manage', :to => 'aspects#manage'