Merge branch 'master' of http://github.com/diaspora/diaspora
This commit is contained in:
commit
1b369a0e49
4 changed files with 19 additions and 9 deletions
|
|
@ -13,5 +13,4 @@ module RequestsHelper
|
|||
link_to t('new_requests', :count => @request_count), aspects_manage_path
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ class Request
|
|||
key :sent, Boolean, :default => false
|
||||
|
||||
validates_presence_of :from, :to
|
||||
validate :not_already_connected, :if => :sent
|
||||
validate :not_already_connected_if_sent
|
||||
validate :not_already_connected_if_not_sent
|
||||
validate :no_pending_request, :if => :sent
|
||||
|
||||
#before_validation :clean_link
|
||||
|
|
@ -91,9 +92,19 @@ class Request
|
|||
end
|
||||
end
|
||||
|
||||
def not_already_connected
|
||||
if Contact.first(:user_id => self.from.owner_id, :person_id => self.to_id)
|
||||
errors[:base] << 'You have already connected to this person!'
|
||||
def not_already_connected_if_sent
|
||||
if self.sent
|
||||
if Contact.first(:user_id => self.from.owner_id, :person_id => self.to.id)
|
||||
errors[:base] << 'You have already connected to this person!'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def not_already_connected_if_not_sent
|
||||
unless self.sent
|
||||
if Contact.first(:user_id => self.to.owner_id, :person_id => self.from.id)
|
||||
errors[:base] << 'You have already connected to this person!'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
%ul.comments{:id => post_id, :class => ("hidden" if defined?(hidden) && hidden)}
|
||||
%ul.comments{:id => post_id, :class => ("hidden" if comment_hashes.size == 0)}
|
||||
- for comment_hash in comment_hashes
|
||||
= render 'comments/comment', comment_hash
|
||||
%li.comment.show
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@
|
|||
= render 'shared/reshare', :current_user => current_user, :post => post if post.is_a? StatusMessage
|
||||
= link_to t('delete'), object_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
|
||||
|
||||
= render type_partial(post), :post => post
|
||||
= render 'status_messages/status_message', :post => post
|
||||
|
||||
.info
|
||||
%span.time= link_to(how_long_ago(post), object_path(post))
|
||||
%span.time= link_to(how_long_ago(post), status_message_path(post))
|
||||
|
||||
= comment_toggle(comments.length)
|
||||
= render "comments/comments", :post_id => post.id, :comment_hashes => comments, :hidden => (comments.length == 0)
|
||||
= render "comments/comments", :post_id => post.id, :comment_hashes => comments
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue