Permalink
Browse files

Step 7.31: Use actual ownership of the message

  • Loading branch information...
dotansimha authored and darkbasic committed Jan 24, 2017
1 parent 0193703 commit 885af27973da8f28b48b581f42b1092235998e6c
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/pages/messages/messages.ts
@@ -18,6 +18,7 @@ export class MessagesPage implements OnInit, OnDestroy {
message: string = '';
autoScroller: MutationObserver;
scrollOffset = 0;
senderId: string;
constructor(
navParams: NavParams,
@@ -26,6 +27,7 @@ export class MessagesPage implements OnInit, OnDestroy {
this.selectedChat = <Chat>navParams.get('chat');
this.title = this.selectedChat.title;
this.picture = this.selectedChat.picture;
this.senderId = Meteor.userId();
}
private get messagesPageContent(): Element {
@@ -55,8 +57,6 @@ export class MessagesPage implements OnInit, OnDestroy {
}
findMessagesDayGroups() {
let isEven = false;
return Messages.find({
chatId: this.selectedChat._id
}, {
@@ -67,8 +67,7 @@ export class MessagesPage implements OnInit, OnDestroy {
// Compose missing data that we would like to show in the view
messages.forEach((message) => {
message.ownership = isEven ? 'mine' : 'other';
isEven = !isEven;
message.ownership = this.senderId == message.senderId ? 'mine' : 'other';
return message;
});

0 comments on commit 885af27

Please sign in to comment.