@messages=PrivateMessage.find_by_sql("SELECT ui.* FROM (SELECT * FROM private_messages WHERE STATUS != 2 AND user_id = #{@user.id} ORDER BY id DESC) ui GROUP BY ui.target_id ORDER BY ui.send_time DESC")
@messages=PrivateMessage.find_by_sql("SELECT ui.* FROM (SELECT * FROM private_messages WHERE STATUS != 2 AND user_id = #{@user.id} ORDER BY id DESC) ui GROUP BY ui.target_id ORDER BY ui.send_time DESC")
@ -121,13 +121,6 @@ class OpenSourceProject < ActiveRecord::Base
ApplyProjectMaster.delete_all"apply_type = '#{self.class}' AND apply_id = #{self.id} AND user_id = #{user.id}"
ApplyProjectMaster.delete_all"apply_type = '#{self.class}' AND apply_id = #{self.id} AND user_id = #{user.id}"
end
end
defadmin?(user)
ifuser.admin?orApplyProjectMaster.find(:all,:conditions=>["user_id = ? and apply_type = 'OpenSourceProject' and apply_id = ? and status = ?",user.id,self.id,2]).present?