0225263 4 mesi fa
parent
commit
d6c2693824

+ 2 - 0
src/app/feedback/feedback.page.html

@@ -37,6 +37,8 @@
 <ion-content class="chat-content">
   <ion-list lines="none">
     <ion-item *ngFor="let message of messageList" class="message-item">
+      1{{message?.get('sendUser')?.objectId}} - 2{{user?.id}}
+      3{{message?.get('receiveUser')?.objectId}} - 4{{targetId}}
       <ion-label class="message-container"
                  [class.sent-message-container]="message?.get('sendUser')?.id === user?.id"
                  [class.received-message-container]="message?.get('receiveUser')?.id === targetId">

+ 6 - 1
src/app/feedback/feedback.page.ts

@@ -79,7 +79,7 @@ export class FeedbackPage implements OnInit {
       return;
     }
     let sendUser = Parse.User?.current()?.toPointer()
-    let receiveUser = {__type:"Pointer",className:"_User",objectId:this.userid}
+    let receiveUser = {__type:"Pointer",className:"_User",objectId:this.targetId}
     let Message = Parse.Object.extend("Message");
     let message = new Message();
     message.set("sendUser",sendUser)
@@ -144,7 +144,12 @@ export class FeedbackPage implements OnInit {
       ]
     }})
 
+    query.addDescending("createdAt")
+    query.limit(5)
+    query.include("sendUser","receiveUser")
+
     let list = await query.find();
+    console.log(list)
     if(list?.length){
       this.messageList = list
     }