Merge branch 'edge' into meteor-1.8

This commit is contained in:
Lauri Ojansivu 2019-05-09 16:37:18 +03:00
commit 34b1654077
10 changed files with 86 additions and 8 deletions

View file

@ -1,6 +1,14 @@
# Upcoming Wekan release
# v2.66 2019-05-09 Wekan release
This release adds the following new translations:
This release adds the following new features:
- [Delete user feature](https://github.com/wekan/wekan/pull/2384).
Thanks to Akuket.
- Change to Delete user feature: [When last board admin is removed, board is not deleted, other board users can
still use it](https://github.com/wekan/wekan/commit/e1b016cf3d4ff93e9e0fe1feb96372e3e1625233).
Thanks to xet7.
and adds the following new translations:
- Add Chinese (Hong Kong).
Thanks to translators.
@ -9,6 +17,10 @@ and fixes the following bugs:
- [Fix OIDC login](https://github.com/wekan/wekan/pull/2385). Related [#2383](https://github.com/wekan/wekan/issues/2383).
Thanks to faust64.
- [Fix missing profile checks](https://github.com/wekan/wekan/pull/2396).
Thanks to justinr1234.
- [Fix RTL issue #884, part 1](https://github.com/wekan/wekan/pull/2395).
Thanks to guyzyl.
Thanks to above GitHub users for their contributions and translators for their translations.

View file

@ -1,5 +1,5 @@
appId: wekan-public/apps/77b94f60-dec9-0136-304e-16ff53095928
appVersion: "v2.65.0"
appVersion: "v2.66.0"
files:
userUploads:
- README.md

View file

@ -107,5 +107,8 @@ template(name="editUserPopup")
label
| {{_ 'password'}}
input.js-profile-password(type="password")
div.buttonsContainer
input.primary.wide(type="submit" value="{{_ 'save'}}")
div
input#deleteButton.primary.wide(type="button" value="{{_ 'delete'}}")
input.primary.wide(type="submit" value="{{_ 'save'}}")

View file

@ -98,6 +98,7 @@ Template.peopleRow.helpers({
Template.editUserPopup.onCreated(function() {
this.authenticationMethods = new ReactiveVar([]);
this.errorMessage = new ReactiveVar('');
Meteor.call('getAuthenticationsEnabled', (_, result) => {
if (result) {
@ -129,6 +130,9 @@ Template.editUserPopup.helpers({
const selected = Users.findOne(userId).authenticationMethod;
return selected === 'ldap';
},
errorMessage() {
return Template.instance().errorMessage.get();
},
});
BlazeComponent.extendComponent({
@ -220,4 +224,9 @@ Template.editUserPopup.events({
});
} else Popup.close();
},
'click #deleteButton'() {
Users.remove(this.userId);
Popup.close();
},
});

View file

@ -34,3 +34,15 @@ table
button
min-width: 60px;
.content-wrapper
margin-top: 10px
.buttonsContainer
display: flex
input
margin: 0
div
margin: auto

View file

@ -53,7 +53,10 @@ template(name="editProfilePopup")
input.js-profile-email(type="email" value="{{emails.[0].address}}")
else
input.js-profile-email(type="email" value="{{emails.[0].address}}" readonly)
input.primary.wide(type="submit" value="{{_ 'save'}}")
div.buttonsContainer
input.primary.wide(type="submit" value="{{_ 'save'}}")
div
input#deleteButton.primary.wide(type="button" value="{{_ 'delete'}}")
template(name="changePasswordPopup")
+atForm(state='changePwd')

View file

@ -95,6 +95,11 @@ Template.editProfilePopup.events({
});
} else Popup.back();
},
'click #deleteButton'() {
Users.remove(Meteor.userId());
Popup.close();
AccountsTemplates.logout();
},
});
// XXX For some reason the useraccounts autofocus isnt working in this case.

View file

@ -238,6 +238,19 @@ Users.allow({
const user = Users.findOne(userId);
return user && Meteor.user().isAdmin;
},
remove(userId, doc) {
const adminsNumber = Users.find({ isAdmin: true }).count();
const { isAdmin } = Users.findOne({ _id: userId }, { fields: { 'isAdmin': 1 } });
// Prevents remove of the only one administrator
if (adminsNumber === 1 && isAdmin && userId === doc._id) {
return false;
}
// If it's the user or an admin
return userId === doc._id || isAdmin;
},
fetch: [],
});
// Search a user in the complete server database by its name or username. This
@ -364,6 +377,10 @@ Users.helpers({
getTemplatesBoardSlug() {
return (Boards.findOne((this.profile || {}).templatesBoardId) || {}).slug;
},
remove() {
User.remove({ _id: this._id});
},
});
Users.mutations({
@ -673,6 +690,23 @@ if (Meteor.isServer) {
}, {unique: true});
});
// OLD WAY THIS CODE DID WORK: When user is last admin of board,
// if admin is removed, board is removed.
// NOW THIS IS COMMENTED OUT, because other board users still need to be able
// to use that board, and not have board deleted.
// Someone can be later changed to be admin of board, by making change to database.
// TODO: Add UI for changing someone as board admin.
//Users.before.remove((userId, doc) => {
// Boards
// .find({members: {$elemMatch: {userId: doc._id, isAdmin: true}}})
// .forEach((board) => {
// // If only one admin for the board
// if (board.members.filter((e) => e.isAdmin).length === 1) {
// Boards.remove(board._id);
// }
// });
//});
// Each board document contains the de-normalized number of users that have
// starred it. If the user star or unstar a board, we need to update this
// counter.

View file

@ -1,6 +1,6 @@
{
"name": "wekan",
"version": "v2.65.0",
"version": "v2.66.0",
"description": "Open-Source kanban",
"private": true,
"scripts": {

View file

@ -22,10 +22,10 @@ const pkgdef :Spk.PackageDefinition = (
appTitle = (defaultText = "Wekan"),
# The name of the app as it is displayed to the user.
appVersion = 267,
appVersion = 268,
# Increment this for every release.
appMarketingVersion = (defaultText = "2.65.0~2019-04-24"),
appMarketingVersion = (defaultText = "2.66.0~2019-05-09"),
# Human-readable presentation of the app version.
minUpgradableAppVersion = 0,