IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
402 | 402 | public function test_is_valid_invalid_thread() { |
403 | 403 | $this->assertEquals( null, BP_Messages_Thread::is_valid( 999 ) ); |
404 | 404 | } |
| 405 | |
| 406 | /** |
| 407 | * @group last_message |
| 408 | */ |
| 409 | public function test_last_message_populated() { |
| 410 | $u1 = $this->factory->user->create(); |
| 411 | $u2 = $this->factory->user->create(); |
| 412 | |
| 413 | $t1 = $this->factory->message->create( array( |
| 414 | 'sender_id' => $u1, |
| 415 | 'recipients' => array( $u2 ), |
| 416 | 'subject' => 'Foo', |
| 417 | ) ); |
| 418 | |
| 419 | $thread = new BP_Messages_Thread( $t1 ); |
| 420 | |
| 421 | $this->assertEquals( 'Foo', $thread->last_message_subject ); |
| 422 | $this->assertEquals( $u1, $thread->last_sender_id ); |
| 423 | } |
405 | 424 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
1846 | 1846 | public function __construct( $thread_id = 0, $order = 'ASC', $args = array() ) { |
1847 | 1847 | $this->thread = new BP_Messages_Thread( $thread_id, $order, $args ); |
1848 | 1848 | $this->message_count = count( $this->thread->messages ); |
1849 | | |
1850 | | $last_message_index = $this->message_count - 1; |
1851 | | $this->thread->last_message_id = $this->thread->messages[ $last_message_index ]->id; |
1852 | | $this->thread->last_message_date = $this->thread->messages[ $last_message_index ]->date_sent; |
1853 | | $this->thread->last_sender_id = $this->thread->messages[ $last_message_index ]->sender_id; |
1854 | | $this->thread->last_message_subject = $this->thread->messages[ $last_message_index ]->subject; |
1855 | | $this->thread->last_message_content = $this->thread->messages[ $last_message_index ]->message; |
1856 | 1849 | } |
1857 | 1850 | |
1858 | 1851 | /** |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
164 | 164 | $this->messages = array_reverse( $this->messages ); |
165 | 165 | } |
166 | 166 | |
| 167 | $last_message_index = count( $this->messages ) - 1; |
| 168 | $this->last_message_id = $this->messages[ $last_message_index ]->id; |
| 169 | $this->last_message_date = $this->messages[ $last_message_index ]->date_sent; |
| 170 | $this->last_sender_id = $this->messages[ $last_message_index ]->sender_id; |
| 171 | $this->last_message_subject = $this->messages[ $last_message_index ]->subject; |
| 172 | $this->last_message_content = $this->messages[ $last_message_index ]->message; |
| 173 | |
167 | 174 | foreach ( (array) $this->messages as $key => $message ) { |
168 | 175 | $this->sender_ids[ $message->sender_id ] = $message->sender_id; |
169 | 176 | } |