Listen to subscription updates
This commit is contained in:
parent
1c41214b52
commit
b4ffc7985b
|
@ -32,12 +32,8 @@ export default class MessageBox extends React.PureComponent {
|
|||
return;
|
||||
}
|
||||
|
||||
this.props.onSubmit(this.state.text)
|
||||
.then(() => {
|
||||
this.setState({
|
||||
text: ''
|
||||
});
|
||||
});
|
||||
this.props.onSubmit(this.state.text);
|
||||
this.setState({ text: '' });
|
||||
};
|
||||
|
||||
render() {
|
||||
|
|
|
@ -38,6 +38,7 @@ Meteor.Accounts.onLogin(() => {
|
|||
realm.create('subscriptions', subscription, true);
|
||||
});
|
||||
});
|
||||
Meteor.subscribe('stream-notify-user', `${ Meteor.userId() }/subscriptions-changed`, false);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -80,6 +81,14 @@ export function connect(cb) {
|
|||
realm.create('messages', message, true);
|
||||
});
|
||||
}
|
||||
|
||||
if (ddbMessage.collection === 'stream-notify-user') {
|
||||
realm.write(() => {
|
||||
const data = ddbMessage.fields.args[1];
|
||||
data._server = { id: RocketChat.currentServer };
|
||||
realm.create('subscriptions', data, true);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -81,8 +81,8 @@ export default realm;
|
|||
|
||||
// Clear settings
|
||||
realm.write(() => {
|
||||
const allSettins = realm.objects('settings');
|
||||
realm.delete(allSettins);
|
||||
// const allSettins = realm.objects('settings');
|
||||
// realm.delete(allSettins);
|
||||
|
||||
// realm.create('servers', { id: 'https://demo.rocket.chat', current: false }, true);
|
||||
// realm.create('servers', { id: 'http://localhost:3000', current: false }, true);
|
||||
|
|
Loading…
Reference in New Issue