var proposeSharedSession = function proposeSharedSession(partnerId) {
  Meteor.call('updateSharingState', {
    userId: Meteor.user()._id,
    sharingStatus: SharedState.PROPOSING,
    partnerId: partnerId
  });
  Meteor.call('updateSharingState', {
    userId: partnerId,
    sharingStatus: SharedState.PROPOSED_TO,
    partnerId: Meteor.user()._id
  });
};
Example #2
0
completeTask(task){
  console.log('Task Completed in Service');
  console.log(task);
    if (Meteor.userId()) {
      if(task.status!='COMPLETED')
      Meteor.call('tasks.setStatus', task._id,'COMPLETED');
      else
      Meteor.call('tasks.setStatus', task._id,'ACTIVE');
      //update observable
    // this._taskObserver.next(Tasks.find().fetch());
    } else {
      alert('Please log in to add a task');
    }

}
  sendComment(c) {

    let name = Meteor.users.findOne(Meteor.userId()).profile.name;

    this.comments.push({
      idUser: Meteor.userId(),
      name: name,
      comment: c
    });

    Posts.update(
      {
        _id: this.idPost
      }, {
        $set: {
          comments: this.comments
        }
      }
    );

    Meteor.call('simpanTimeLine', {
      dateTime: new Date(),
      status: 'comment',
      message: `${name} commented on ${this.nameUserPost}'s post`
    }, (error) => {
      if (error) {
        console.log(error);
      }
    });

    this.inputComment = '';
  }
  sendPost(p) {
    let name = Meteor.users.findOne(Meteor.userId()).profile.name;
    Meteor.call('simpanPost', {
      idUser: Meteor.userId(),
      name: name,
      status: p,
      dateTime: new Date(),
      comments: [],
      likes: []
    }, (error) => {
      if (error) {
        console.log(error);
      }
      this.inputPost = '';

      Meteor.call('simpanTimeLine', {
        dateTime: new Date(),
        status: 'post',
        message: `${name} send post '${p}'`
      }, (error) => {
        if (error) {
          console.log(error);
        }
      });
    });
  }
const initializeSharingState = function initializeSharingState(userId: string) {
  Meteor.call('updateSharingState', {
    userId: userId,
    sharingStatus: SharedState.INITIALIZED,
    partnerId: null
  });
};
Example #6
0
 'budget.move-to-top': (category: Category, superCategory: SuperCategory) => {
     const firstNewSiblingCategory = CategoryCollection.findOne({superCategoryId: superCategory._id}, {sort: {budgetSortIndex: 1}});
     if (firstNewSiblingCategory == null) {
         return CategoryCollection.update(category._id, {$set: {superCategoryId: superCategory._id, budgetSortIndex: 0}});
     } else {
         return Meteor.call('budget.move-category', category, firstNewSiblingCategory);
     }
 },
Example #7
0
 public getUserProfile(){
   if(this.cur_user){
     return this.user.profile;
   }
   else{
     return Meteor.call('getUserProfile',[this.userid]);
   }
 }
 return new Promise<boolean>( (resolve, reject)=> {
   Meteor.call('removeRole', role, (error)=> {
     if (error) {
       reject(error);
     } else {
       resolve(true);
     }
   });
 });
 answer(answer) {
   Meteor.call('rsvp', this.party._id, answer, (error) => {
     if (error) {
       console.error('Oops, unable to rsvp!');
     } else {
       console.log('RSVP done!')
     }
   });
 }
 doAddNewItem() {
     Meteor.call('addItem', this.newItem, function (error, result) {
         if (error) {
             console.log(error)
         } else {
             console.log(result)
         }
     });
 }