[Isocial-svn] SF.net SVN: isocial: [51] app/controllers/message_controller.php
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <di...@us...> - 2008-03-09 14:16:30
|
Revision: 51 http://isocial.svn.sourceforge.net/isocial/?rev=51&view=rev Author: dim0s77 Date: 2008-03-09 07:16:35 -0700 (Sun, 09 Mar 2008) Log Message: ----------- fix message_threads calculation Modified Paths: -------------- app/controllers/message_controller.php Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-09 13:53:21 UTC (rev 50) +++ app/controllers/message_controller.php 2008-03-09 14:16:35 UTC (rev 51) @@ -10,14 +10,10 @@ function inbox () { $this->inbox_messages = $this->_getBoxMessages('inbox_message'); - $this->message_threads = $this->Message->count('thread_id', array('distinct' => 'thread_id', - 'conditions' => "sender_id = " . $this->current_user->getId())); } function outbox () { $this->outbox_messages = $this->_getBoxMessages('outbox_message'); - $this->message_threads = $this->Message->count('thread_id', array('distinct' => 'thread_id', - 'conditions' => "recipient_id = " . $this->current_user->getId())); } function _getBoxMessages ($box_message) { @@ -30,6 +26,9 @@ } } } + $user_id = $box_message == 'inbox_message' ? 'sender_id' : 'recipient_id'; + $this->message_threads = $this->Message->count('thread_id', array('distinct' => 'thread_id', + 'conditions' => "$user_id = " . $this->current_user->getId())); return $box_messages; } @@ -143,7 +142,7 @@ } } return $this->render(array('partial' => 'rows', - 'locals' => array('messages' => $this->_getInboxMessages(), + 'locals' => array('messages' => $this->_getBoxMessages('inbox_message'), 'target' => 'sender'))); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |