diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-09-04 01:40:29 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-09-04 01:44:10 +0200 |
commit | 521e661dcb38b5a58b70593f3b805be57bd6746f (patch) | |
tree | 9a38fbefdb491ab3564b8fba96acfe1776939b2d | |
parent | 40fafd4b142c541172cd23dabd8e7304b2a4035b (diff) | |
download | wekan-521e661dcb38b5a58b70593f3b805be57bd6746f.tar.gz wekan-521e661dcb38b5a58b70593f3b805be57bd6746f.tar.bz2 wekan-521e661dcb38b5a58b70593f3b805be57bd6746f.zip |
Change our presence package
tmeasday:presence was doing unnecessary ping calls to the server every
5 seconds instead of using the status of the DDP connection (this
could save a fair amount of traffic in case of important server load).
I guess this change also fixes #221, but since no issue reproduction
was provided, it's difficult to tell.
-rw-r--r-- | .eslintrc | 2 | ||||
-rw-r--r-- | .meteor/packages | 2 | ||||
-rw-r--r-- | .meteor/versions | 2 | ||||
-rw-r--r-- | client/components/users/userAvatar.js | 2 | ||||
-rw-r--r-- | client/config/presence.js | 7 | ||||
-rw-r--r-- | collections/users.js | 7 | ||||
-rw-r--r-- | server/publications/boards.js | 2 |
7 files changed, 12 insertions, 12 deletions
@@ -113,7 +113,7 @@ globals: Mousetrap: false Picker: false Presence: true - Presences: true + presences: true Ps: true ReactiveTabs: false SimpleSchema: false diff --git a/.meteor/packages b/.meteor/packages index 43019d91..0aa0fa68 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -44,6 +44,7 @@ reactive-dict session tracker underscore +3stack:presence alethes:pages arillo:flow-router-helpers audit-argument-checks @@ -56,7 +57,6 @@ mquandalle:moment ongoworks:speakingurl raix:handlebar-helpers tap:i18n -tmeasday:presence # UI components blaze diff --git a/.meteor/versions b/.meteor/versions index 3815fd42..3e658189 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -1,3 +1,4 @@ +3stack:presence@1.0.3 accounts-base@1.2.1-rc.2 accounts-password@1.1.2-rc.1 aldeed:collection2@2.3.3 @@ -126,7 +127,6 @@ tap:i18n@1.5.1 templates:tabs@2.2.0 templating@1.1.2-rc.4 templating-tools@1.0.0-rc.0 -tmeasday:presence@1.0.6 tracker@1.0.8-rc.0 ui@1.0.7-rc.0 underscore@1.0.4-rc.0 diff --git a/client/components/users/userAvatar.js b/client/components/users/userAvatar.js index b0702468..5337f6e2 100644 --- a/client/components/users/userAvatar.js +++ b/client/components/users/userAvatar.js @@ -16,7 +16,7 @@ Template.userAvatar.helpers({ }, presenceStatusClassName() { - const userPresence = Presences.findOne({ userId: this.userId }); + const userPresence = presences.findOne({ userId: this.userId }); if (!userPresence) return 'disconnected'; else if (Session.equals('currentBoard', userPresence.state.currentBoardId)) diff --git a/client/config/presence.js b/client/config/presence.js new file mode 100644 index 00000000..39b94e4d --- /dev/null +++ b/client/config/presence.js @@ -0,0 +1,7 @@ +Presence.configure({ + state() { + return { + currentBoardId: Session.get('currentBoard'), + }; + }, +}); diff --git a/collections/users.js b/collections/users.js index b30b7805..276c9f9e 100644 --- a/collections/users.js +++ b/collections/users.js @@ -145,10 +145,3 @@ if (Meteor.isServer) { }); }); } - -// Presence indicator -if (Meteor.isClient) { - Presence.state = () => { - return { currentBoardId: Session.get('currentBoard') }; - }; -} diff --git a/server/publications/boards.js b/server/publications/boards.js index 7f6a544b..403d0084 100644 --- a/server/publications/boards.js +++ b/server/publications/boards.js @@ -141,7 +141,7 @@ Meteor.publishComposite('board', function(boardId) { // Presence indicators children: [{ find(user) { - return Presences.find({userId: user._id}); + return presences.find({userId: user._id}); }, }], }, |