ryancp / sailng

Sails.js + Angular = Awesome
MIT License
164 stars 38 forks source link

Invalid usage of user`publishAdd(...)` #8

Closed blah238 closed 9 years ago

blah238 commented 10 years ago

I went through and changed all instances of .done to .exec as described in https://github.com/ryancp/sailng/issues/5.

When running the sailng app and entering messages, the following error appears in the node console, but everything appears to still operate correctly (messages appear on all connected clients).

error: Invalid usage of userpublishAdd(id, alias, isAdded, [socketToOmit])``

Any ideas what this is about?

ryancp commented 10 years ago

This definitely has to do with the afterCreate method in Message,js model. That call basically adds the associated user to the message model that gets sent to the frontend so that the username can be displayed immediately upon a message creation.

There is probably a better way within sails to handle this idea which I need to revisit. I explained more in a post on the sails google group: https://groups.google.com/d/msg/sailsjs/BiCMKRvJULE/ck7Cl5NTt4MJ

ryancp commented 9 years ago

This should be fixed by a recent commit.