123456789101112131415161718192021222324252627282930313233 |
- Template.chat_message.helpers({
- sender: function () {
- const me = Meteor.userId();
- let result;
- if (this.message.sender === me) {
- if (me) {
- result = Meteor.user();
- }
- else {
- result = {
- profile: {
- username: "Anonymous",
- avatar: "anonymous.png"
- }
- };
- }
- }
- else if (this.message.sender === this.other._id) {
- result = this.other;
- }
- else {
- result = {
- profile: {
- username: `Unknown user ${this.message.sender}.`,
- avatar: "ghost.png"
- }
- };
- }
- console.log("returning", result);
- return result;
- }
- });
|