File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 4
4
5
5
namespace CarAndClassic \TalkJS \Models ;
6
6
7
+ use CarAndClassic \TalkJS \Models \Message ;
8
+
7
9
class Conversation
8
10
{
9
11
public string $ id ;
@@ -18,6 +20,8 @@ class Conversation
18
20
19
21
public array $ custom ;
20
22
23
+ public ?Message $ lastMessage ;
24
+
21
25
public array $ participants ;
22
26
23
27
public int $ createdAt ;
@@ -30,6 +34,7 @@ public function __construct(array $data)
30
34
$ this ->photoUrl = $ data ['photoUrl ' ] ?? null ;
31
35
$ this ->welcomeMessages = $ data ['welcomeMessages ' ] ?? [];
32
36
$ this ->custom = $ data ['custom ' ] ?? [];
37
+ $ this ->lastMessage = isset ($ data ['lastMessage ' ]) ? new Message ($ data ['lastMessage ' ]) : null ;
33
38
$ this ->participants = $ data ['participants ' ] ?? [];
34
39
$ this ->createdAt = $ data ['createdAt ' ];
35
40
}
Original file line number Diff line number Diff line change 13
13
use CarAndClassic \TalkJS \Events \ConversationRead ;
14
14
use CarAndClassic \TalkJS \Events \ParticipationUpdated ;
15
15
use CarAndClassic \TalkJS \Models \Conversation ;
16
+ use CarAndClassic \TalkJS \Models \Message ;
16
17
use Symfony \Component \HttpClient \Response \MockResponse ;
17
18
18
19
final class ConversationTest extends TestCase
@@ -37,6 +38,21 @@ public function setUp(): void
37
38
'photoUrl ' => null ,
38
39
'welcomeMessages ' => ['Test Welcome Message ' ],
39
40
'custom ' => ['test ' => 'test ' ],
41
+ 'lastMessage ' => new Message ([
42
+ 'id ' => "test " ,
43
+ 'type ' => "UserMessage " ,
44
+ 'conversationId ' => "dev_test " ,
45
+ 'senderId ' => $ this ->userIds [1 ],
46
+ 'text ' => "This is the message copy " ,
47
+ 'readBy ' => [
48
+ $ this ->userIds [0 ],
49
+ ],
50
+ 'origin ' => "rest " ,
51
+ 'location ' => null ,
52
+ 'custom ' => [],
53
+ 'attachment ' => null ,
54
+ 'createdAt ' => $ createdAt ,
55
+ ]),
40
56
'participants ' => [
41
57
$ this ->userIds [0 ] => [
42
58
'access ' => 'ReadWrite ' ,
@@ -56,6 +72,7 @@ public function setUp(): void
56
72
'photoUrl ' => null ,
57
73
'welcomeMessages ' => ['Test Welcome Message ' ],
58
74
'custom ' => ['test ' => 'test ' ],
75
+ 'lastMessage ' => null ,
59
76
'participants ' => [
60
77
$ this ->userIds [0 ] => [
61
78
'access ' => 'ReadWrite ' ,
You can’t perform that action at this time.
0 commit comments