Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hubot Compatibility #2931

Merged
merged 5 commits into from
Apr 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ konecty:nrr
konecty:user-presence

rocketchat:streamer
arunoda:streams
chrismbeckett:toastr
dispatch:run-as-user
francocatena:status
Expand Down
1 change: 1 addition & 0 deletions .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ [email protected]
[email protected]
[email protected]
aldeed:[email protected]
arunoda:[email protected]
[email protected]
[email protected]_1
[email protected]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
msgStream = new Meteor.Streamer 'messages'
msgStream = new Meteor.Streamer 'room-messages'
Tracker.autorun ->
if visitor.getRoom()?
msgStream.on visitor.getRoom(), (msg) ->
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui/lib/RoomManager.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ RocketChat.Notifications.onUser 'message', (msg) ->
@RoomManager = new class
openedRooms = {}
subscription = null
msgStream = new Meteor.Streamer 'messages'
msgStream = new Meteor.Streamer 'room-messages'
onlineUsers = new ReactiveVar {}

Dep = new Tracker.Dependency
Expand Down
22 changes: 21 additions & 1 deletion server/stream/messages.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
@msgStream = new Meteor.Streamer 'messages'
# COMPATIBILITY
oldMsgStream = new Meteor.Stream 'messages'

oldMsgStream.permissions.write (eventName) ->
return false

oldMsgStream.permissions.read (eventName) ->
try
canAccess = Meteor.call 'canAccessRoom', eventName, this.userId

return false if not canAccess

return true
catch e
return false
# COMPATIBILITY


@msgStream = new Meteor.Streamer 'room-messages'

msgStream.allowWrite('none')

Expand All @@ -24,7 +42,9 @@ Meteor.startup ->

RocketChat.models.Messages.findVisibleCreatedOrEditedAfterTimestamp(new Date(), options).observe
added: (record) ->
oldMsgStream.emit record.rid, record
msgStream.emitWithoutBroadcast record.rid, record

changed: (record) ->
oldMsgStream.emit record.rid, record
msgStream.emitWithoutBroadcast record.rid, record