From d6ba734fa9e5b2c4c4bc11c3af1a59a284a15d8b Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Tue, 22 Dec 2015 22:19:27 +0100 Subject: Release 0.10.0 --- sandstorm-pkgdef.capnp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sandstorm-pkgdef.capnp b/sandstorm-pkgdef.capnp index 052059d5..3e545b27 100644 --- a/sandstorm-pkgdef.capnp +++ b/sandstorm-pkgdef.capnp @@ -22,10 +22,10 @@ const pkgdef :Spk.PackageDefinition = ( appTitle = (defaultText = "Wekan"), # The name of the app as it is displayed to the user. - appVersion = 8, + appVersion = 9, # Increment this for every release. - appMarketingVersion = (defaultText = "0.10-rc4"), + appMarketingVersion = (defaultText = "0.10"), # Human-readable presentation of the app version. minUpgradableAppVersion = 0, -- cgit v1.2.3-1-g7c22 From 15e692a7d27f36d2f5079d4e74232c2dd4fb5e58 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Tue, 29 Dec 2015 18:08:24 +0100 Subject: Fix drag and drop on Sandstorm This bug was introduced with the introduction of fast-render in 41b23f8. With fast-render data is available instantly after the page logging, but calls to `Meteor.userId()` still return `null` as the user isn't authenticated on the DDP channel yet (previously the data was loaded on DDP after user authentication). Which mean that we know need to reactively activate Drag and Drop on user log in. I'm not sure why I was not able to reproduce this bug outside of Sandstorm. Fixes #453 --- client/components/boards/boardBody.js | 14 ++++++++------ client/components/lists/list.js | 12 +++++++++--- client/components/sidebar/sidebar.js | 14 ++++++++++---- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index aa55baad..9c1625cd 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -135,9 +135,6 @@ Template.boardBody.onRendered(function() { }, }; - if (!Meteor.user() || !Meteor.user().isBoardMember()) - return; - $(self.listsDom).sortable({ tolerance: 'pointer', helper: 'clone', @@ -163,16 +160,21 @@ Template.boardBody.onRendered(function() { }, }); - // Disable drag-dropping while in multi-selection mode + function userIsMember() { + return Meteor.user() && Meteor.user().isBoardMember(); + } + + // Disable drag-dropping while in multi-selection mode, or if the current user + // is not a board member self.autorun(() => { $(self.listsDom).sortable('option', 'disabled', - MultiSelection.isActive()); + MultiSelection.isActive() || !userIsMember()); }); // If there is no data in the board (ie, no lists) we autofocus the list // creation form by clicking on the corresponding element. const currentBoard = Boards.findOne(Session.get('currentBoard')); - if (currentBoard.lists().count() === 0) { + if (userIsMember() && currentBoard.lists().count() === 0) { self.openNewListForm(); } }); diff --git a/client/components/lists/list.js b/client/components/lists/list.js index f5410ed0..e454cb48 100644 --- a/client/components/lists/list.js +++ b/client/components/lists/list.js @@ -22,9 +22,6 @@ BlazeComponent.extendComponent({ // callback, we basically solve all issues related to reactive updates. A // comment below provides further details. onRendered() { - if (!Meteor.user() || !Meteor.user().isBoardMember()) - return; - const boardComponent = this.parentComponent(); const itemsSelector = '.js-minicard:not(.placeholder, .js-card-composer)'; const $cards = this.$('.js-minicards'); @@ -85,6 +82,15 @@ BlazeComponent.extendComponent({ }, }); + function userIsMember() { + return Meteor.user() && Meteor.user().isBoardMember(); + } + + // Disable drag-dropping if the current user is not a board member + this.autorun(() => { + $cards.sortable('option', 'disabled', !userIsMember()); + }); + // We want to re-run this function any time a card is added. this.autorun(() => { const currentBoardId = Tracker.nonreactive(() => { diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index 35651622..15a4ce44 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -195,9 +195,6 @@ Template.labelsWidget.events({ // autorun function and register a dependency on the both members and labels // fields of the current board document. function draggableMembersLabelsWidgets() { - if (!Meteor.user() || !Meteor.user().isBoardMember()) - return; - this.autorun(() => { const currentBoardId = Tracker.nonreactive(() => { return Session.get('currentBoard'); @@ -209,7 +206,8 @@ function draggableMembersLabelsWidgets() { }, }); Tracker.afterFlush(() => { - this.$('.js-member,.js-label').draggable({ + const $draggables = this.$('.js-member,.js-label'); + $draggables.draggable({ appendTo: 'body', helper: 'clone', revert: 'invalid', @@ -220,6 +218,14 @@ function draggableMembersLabelsWidgets() { EscapeActions.executeUpTo('popup-back'); }, }); + + function userIsMember() { + return Meteor.user() && Meteor.user().isBoardMember(); + } + + this.autorun(() => { + $draggables.draggable('option', 'disabled', !userIsMember()); + }); }); }); } -- cgit v1.2.3-1-g7c22 From 0587223489b3c2e44c7670cb12dac1d221f0a455 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Wed, 30 Dec 2015 19:16:49 +0100 Subject: Fix avatar support on Sanstorm The bug comes for 9154b06 which this commit partially reverts. The synchronization between the user document profile and the Sandstorm HTTP headers is still not perfect. Having a clean model may requires the `accounts-sandstorm` to expose a hook to modify the user document just after the `services.sandstorm` credentials are updated. Fixes #460 --- client/components/users/userAvatar.jade | 4 ++-- models/users.js | 13 ------------- sandstorm.js | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/client/components/users/userAvatar.jade b/client/components/users/userAvatar.jade index 44e899a7..e08666e5 100644 --- a/client/components/users/userAvatar.jade +++ b/client/components/users/userAvatar.jade @@ -1,7 +1,7 @@ template(name="userAvatar") a.member.js-member(title="{{userData.profile.fullname}} ({{userData.username}})") - if userData.getAvatarUrl - img.avatar.avatar-image(src=userData.getAvatarUrl) + if userData.profile.avatarUrl + img.avatar.avatar-image(src=userData.profile.avatarUrl) else +userAvatarInitials(userId=userData._id) diff --git a/models/users.js b/models/users.js index cf4c4193..8dd5ed78 100644 --- a/models/users.js +++ b/models/users.js @@ -47,19 +47,6 @@ Users.helpers({ return _.contains(invitedBoards, boardId); }, - getAvatarUrl() { - // Although we put the avatar picture URL in the `profile` object, we need - // to support Sandstorm which put in the `picture` attribute by default. - // XXX Should we move both cases to `picture`? - if (this.picture) { - return this.picture; - } else if (this.profile && this.profile.avatarUrl) { - return this.profile.avatarUrl; - } else { - return null; - } - }, - getInitials() { const profile = this.profile || {}; if (profile.initials) diff --git a/sandstorm.js b/sandstorm.js index 5148095f..85124f04 100644 --- a/sandstorm.js +++ b/sandstorm.js @@ -65,11 +65,23 @@ if (isSandstorm && Meteor.isServer) { // accesses the document, but in case a already known user comes back, we // need to update his associated document to match the request HTTP headers // informations. + // XXX We need to update this document even if the initial route is not `/`. + // Unfortuanlty I wasn't able to make the Webapp.rawConnectHandlers solution + // work. const user = Users.findOne({ 'services.sandstorm.id': req.headers['x-sandstorm-user-id'], }); if (user) { - updateUserPermissions(user._id, user.permissions); + // XXX At this point the user.services.sandstorm credentials haven't been + // updated, which mean that the user will have to restart the application + // a second time to see its updated name and avatar. + Users.update(user._id, { + $set: { + 'profile.fullname': user.services.sandstorm.name, + 'profile.avatarUrl': user.services.sandstorm.picture, + }, + }); + updateUserPermissions(user._id, user.services.sandstorm.permissions); } }); @@ -109,6 +121,7 @@ if (isSandstorm && Meteor.isServer) { $set: { username: generateUniqueUsername(username, appendNumber), 'profile.fullname': doc.services.sandstorm.name, + 'profile.avatarUrl': doc.services.sandstorm.picture, }, }); -- cgit v1.2.3-1-g7c22 From 5495829f11f707f38090941ebdfc26b141ac5b90 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Wed, 30 Dec 2015 19:26:37 +0100 Subject: Release 0.10.1 --- CHANGELOG.md | 7 +++++++ sandstorm-pkgdef.capnp | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab8b9859..10ae1def 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# v0.10.1 + +This patch release fixes two bugs on Sandstorm: + +* Drag and drop was broken; +* Avatars weren’t working. + # v0.10 This release features: diff --git a/sandstorm-pkgdef.capnp b/sandstorm-pkgdef.capnp index 3e545b27..375f1a20 100644 --- a/sandstorm-pkgdef.capnp +++ b/sandstorm-pkgdef.capnp @@ -22,10 +22,10 @@ const pkgdef :Spk.PackageDefinition = ( appTitle = (defaultText = "Wekan"), # The name of the app as it is displayed to the user. - appVersion = 9, + appVersion = 10, # Increment this for every release. - appMarketingVersion = (defaultText = "0.10"), + appMarketingVersion = (defaultText = "0.10.1"), # Human-readable presentation of the app version. minUpgradableAppVersion = 0, -- cgit v1.2.3-1-g7c22