{"action":"created","issue":{"url":"https://api.github.com/repos/feathersjs/feathers/issues/376","repository_url":"https://api.github.com/repos/feathersjs/feathers","labels_url":"https://api.github.com/repos/feathersjs/feathers/issues/376/labels{/name}","comments_url":"https://api.github.com/repos/feathersjs/feathers/issues/376/comments","events_url":"https://api.github.com/repos/feathersjs/feathers/issues/376/events","html_url":"https://github.com/feathersjs/feathers/issues/376","id":168741072,"number":376,"title":"Hooks do not aplly for realtime events","user":{"login":"Mangatt","id":2706990,"avatar_url":"https://avatars.githubusercontent.com/u/2706990?v=3","gravatar_id":"","url":"https://api.github.com/users/Mangatt","html_url":"https://github.com/Mangatt","followers_url":"https://api.github.com/users/Mangatt/followers","following_url":"https://api.github.com/users/Mangatt/following{/other_user}","gists_url":"https://api.github.com/users/Mangatt/gists{/gist_id}","starred_url":"https://api.github.com/users/Mangatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mangatt/subscriptions","organizations_url":"https://api.github.com/users/Mangatt/orgs","repos_url":"https://api.github.com/users/Mangatt/repos","events_url":"https://api.github.com/users/Mangatt/events{/privacy}","received_events_url":"https://api.github.com/users/Mangatt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-08-01T21:00:10Z","updated_at":"2016-08-02T14:34:07Z","closed_at":null,"body":"Hi,\r\nI've just found that hooks do not apply for realtime events. Following code will remove password field from service response.\r\n\r\n`app.service('users').after({\r\n\tall: hooks.remove('password'),\r\n});`\r\n\r\nBut when entry is updated, whole entry is emmited through updated event, even with password field.\r\n\r\nAre there any plans for unifiying filters for both service methods and realtime events or is there any workaround?"},"comment":{"url":"https://api.github.com/repos/feathersjs/feathers/issues/comments/236923435","html_url":"https://github.com/feathersjs/feathers/issues/376#issuecomment-236923435","issue_url":"https://api.github.com/repos/feathersjs/feathers/issues/376","id":236923435,"user":{"login":"daffl","id":338316,"avatar_url":"https://avatars.githubusercontent.com/u/338316?v=3","gravatar_id":"","url":"https://api.github.com/users/daffl","html_url":"https://github.com/daffl","followers_url":"https://api.github.com/users/daffl/followers","following_url":"https://api.github.com/users/daffl/following{/other_user}","gists_url":"https://api.github.com/users/daffl/gists{/gist_id}","starred_url":"https://api.github.com/users/daffl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daffl/subscriptions","organizations_url":"https://api.github.com/users/daffl/orgs","repos_url":"https://api.github.com/users/daffl/repos","events_url":"https://api.github.com/users/daffl/events{/privacy}","received_events_url":"https://api.github.com/users/daffl/received_events","type":"User","site_admin":false},"created_at":"2016-08-02T14:34:07Z","updated_at":"2016-08-02T14:34:07Z","body":"One thing to note is that the standard `remove` hook will only run for external calls so events from internal calls to the service will be dispatched with the full data. One way to solve the issue is to add an [event filter](http://docs.feathersjs.com/real-time/filtering.html) that always removes the data:\r\n\r\n```js\r\nconst omit = require('lodash.omit');\r\n\r\napp.service('users').filter(data => omit(data, 'password'));\r\n```\r\n\r\nIt might be a good idea to make the hooks where it applies (like `remove`) to also run as the correct event filters."}}
{"actor":{"display_login":"daffl"}}