you can now reassign a peson's group
This commit is contained in:
parent
22f63a4c44
commit
b4174c664e
5 changed files with 19 additions and 9 deletions
|
|
@ -50,8 +50,14 @@ class GroupsController < ApplicationController
|
|||
end
|
||||
|
||||
def move_person
|
||||
current_user.move_friend( :friend_id => params[:person_id], :from => params[:old_group_id], :to => params[:new_group_id])
|
||||
render :nothing => true
|
||||
unless current_user.move_friend( :friend_id => params[:friend_id], :from => params[:from], :to => params[:to][:to])
|
||||
flash[:error] = "didn't work #{params.inspect}"
|
||||
end
|
||||
if group = Group.first(:id => params[:to][:to])
|
||||
redirect_to group
|
||||
else
|
||||
redirect_to Person.first(:id => params[:friend_id])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ class PeopleController < ApplicationController
|
|||
@profile = @person.profile
|
||||
@person_groups = current_user.groups_with_person(@person)
|
||||
|
||||
|
||||
@groups_array = current_user.groups.collect{|x| [x.to_s, x.id]}
|
||||
|
||||
|
||||
@posts = Post.where(:person_id => @person.id, :_id.in => current_user.visible_post_ids).paginate :page => params[:page], :order => 'created_at DESC'
|
||||
|
||||
@latest_status_message = current_user.raw_visible_posts.find_all_by__type_and_person_id("StatusMessage", params[:id]).last
|
||||
|
|
|
|||
|
|
@ -51,10 +51,8 @@ class User
|
|||
puts posts_to_move.inspect
|
||||
to_group.people << friend
|
||||
to_group.posts << posts_to_move
|
||||
puts to_group.inspect
|
||||
from_group.person_ids.delete(ensure_bson(friend.id))
|
||||
posts_to_move.each{ |x| from_group.post_ids.delete(x.id)}
|
||||
puts from_group.inspect
|
||||
from_group.save
|
||||
to_group.save
|
||||
return true
|
||||
|
|
|
|||
|
|
@ -18,10 +18,12 @@
|
|||
%li
|
||||
="groups: #{@person_groups}"
|
||||
= "edit"
|
||||
= form_for Request.new do |f|
|
||||
= f.select(:group_id, @groups_array)
|
||||
= f.hidden_field :destination_url, :value => person.email
|
||||
= f.submit "add friend"
|
||||
= @groups_array.inspect
|
||||
= form_tag move_person_path
|
||||
= select :to, :to, @groups_array
|
||||
= hidden_field_tag :from, :from, :value => @person_groups.first.id
|
||||
= hidden_field_tag :friend_id, :friend_id, :value => @person.id
|
||||
= submit_tag "save"
|
||||
%li
|
||||
url:
|
||||
= @person.url
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Diaspora::Application.routes.draw do
|
|||
match 'login', :to => 'devise/sessions#new', :as => "new_user_session"
|
||||
match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session"
|
||||
match 'get_to_the_choppa', :to => 'devise/registrations#new', :as => "new_user_registration"
|
||||
|
||||
match 'groups/move_person', :to => 'groups#move_person', :as => 'move_person'
|
||||
#public routes
|
||||
#
|
||||
match 'webfinger', :to => 'publics#webfinger'
|
||||
|
|
|
|||
Loading…
Reference in a new issue