From b925b8e74d8cb55edcb570819cffcb9f0dc061fc Mon Sep 17 00:00:00 2001 From: guillaume Date: Thu, 11 Oct 2018 16:44:52 +0200 Subject: improve notifications --- client/components/users/userHeader.jade | 18 ---- client/components/users/userHeader.js | 20 ----- models/activities.js | 11 --- models/settings.js | 1 + models/users.js | 4 - server/migrations.js | 9 ++ server/notifications/email.js | 1 + server/notifications/notifications.js | 8 +- snap-src/bin/wekan-help | 150 ++++++++++++++++++++++++++++++++ 9 files changed, 163 insertions(+), 59 deletions(-) diff --git a/client/components/users/userHeader.jade b/client/components/users/userHeader.jade index a8fdb143..b6e10d8a 100644 --- a/client/components/users/userHeader.jade +++ b/client/components/users/userHeader.jade @@ -17,7 +17,6 @@ template(name="memberMenuPopup") li: a.js-change-avatar {{_ 'edit-avatar'}} li: a.js-change-password {{_ 'changePasswordPopup-title'}} li: a.js-change-language {{_ 'changeLanguagePopup-title'}} - li: a.js-edit-notification {{_ 'editNotificationPopup-title'}} if currentUser.isAdmin li: a.js-go-setting(href="{{pathFor 'setting'}}") {{_ 'admin-panel'}} hr @@ -50,23 +49,6 @@ template(name="editProfilePopup") input.js-profile-email(type="email" value="{{emails.[0].address}}" readonly) input.primary.wide(type="submit" value="{{_ 'save'}}") -template(name="editNotificationPopup") - ul.pop-over-list - li - a.js-toggle-tag-notify-watch - i.fa.fa-eye.colorful - | {{_ 'watching'}} - if hasTag "notify-watch" - i.fa.fa-check - span.sub-name {{_ 'notify-watch'}} - li - a.js-toggle-tag-notify-participate - i.fa.fa-bell.colorful - | {{_ 'tracking'}} - if hasTag "notify-participate" - i.fa.fa-check - span.sub-name {{_ 'notify-participate'}} - template(name="changePasswordPopup") +atForm(state='changePwd') diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js index d96a9b3d..63cbb14f 100644 --- a/client/components/users/userHeader.js +++ b/client/components/users/userHeader.js @@ -9,7 +9,6 @@ Template.memberMenuPopup.events({ 'click .js-change-avatar': Popup.open('changeAvatar'), 'click .js-change-password': Popup.open('changePassword'), 'click .js-change-language': Popup.open('changeLanguage'), - 'click .js-edit-notification': Popup.open('editNotification'), 'click .js-logout'(evt) { evt.preventDefault(); @@ -89,25 +88,6 @@ Template.editProfilePopup.events({ }, }); -Template.editNotificationPopup.helpers({ - hasTag(tag) { - const user = Meteor.user(); - return user && user.hasTag(tag); - }, -}); - -// we defined github like rules, see: https://github.com/settings/notifications -Template.editNotificationPopup.events({ - 'click .js-toggle-tag-notify-participate'() { - const user = Meteor.user(); - if (user) user.toggleTag('notify-participate'); - }, - 'click .js-toggle-tag-notify-watch'() { - const user = Meteor.user(); - if (user) user.toggleTag('notify-watch'); - }, -}); - // XXX For some reason the useraccounts autofocus isnt working in this case. // See https://github.com/meteor-useraccounts/core/issues/384 Template.changePasswordPopup.onRendered(function () { diff --git a/models/activities.js b/models/activities.js index c3c8f173..aad5d412 100644 --- a/models/activities.js +++ b/models/activities.js @@ -152,17 +152,6 @@ if (Meteor.isServer) { if (board) { const watchingUsers = _.pluck(_.where(board.watchers, {level: 'watching'}), 'userId'); const trackingUsers = _.pluck(_.where(board.watchers, {level: 'tracking'}), 'userId'); - const mutedUsers = _.pluck(_.where(board.watchers, {level: 'muted'}), 'userId'); - switch(board.getWatchDefault()) { - case 'muted': - participants = _.intersection(participants, trackingUsers); - watchers = _.intersection(watchers, trackingUsers); - break; - case 'tracking': - participants = _.difference(participants, mutedUsers); - watchers = _.difference(watchers, mutedUsers); - break; - } watchers = _.union(watchers, watchingUsers || []); } diff --git a/models/settings.js b/models/settings.js index bb555cf9..2f82e52f 100644 --- a/models/settings.js +++ b/models/settings.js @@ -116,6 +116,7 @@ if (Meteor.isServer) { url: FlowRouter.url('sign-up'), }; const lang = author.getLanguage(); + Email.send({ to: icode.email, from: Accounts.emailTemplates.from, diff --git a/models/users.js b/models/users.js index 9a195850..31d5cf60 100644 --- a/models/users.js +++ b/models/users.js @@ -89,10 +89,6 @@ Users.attachSchema(new SimpleSchema({ type: [String], optional: true, }, - 'profile.tags': { - type: [String], - optional: true, - }, 'profile.icode': { type: String, optional: true, diff --git a/server/migrations.js b/server/migrations.js index 1d62d796..a5d93a4c 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -333,3 +333,12 @@ Migrations.add('add-authenticationMethod', () => { }, }, noValidateMulti); }); + +Migrations.add('remove-tag', () => { + Users.update({ + }, { + $unset: { + 'profile.tags':1, + }, + }, noValidateMulti); +}); \ No newline at end of file diff --git a/server/notifications/email.js b/server/notifications/email.js index b2b7fab8..fc05456f 100644 --- a/server/notifications/email.js +++ b/server/notifications/email.js @@ -2,6 +2,7 @@ Meteor.startup(() => { Notifications.subscribe('email', (user, title, description, params) => { // add quote to make titles easier to read in email text + console.log('ICI', user, title, description, params); const quoteParams = _.clone(params); ['card', 'list', 'oldList', 'board', 'comment'].forEach((key) => { if (quoteParams[key]) quoteParams[key] = `"${params[key]}"`; diff --git a/server/notifications/notifications.js b/server/notifications/notifications.js index bc5557e1..72692ef8 100644 --- a/server/notifications/notifications.js +++ b/server/notifications/notifications.js @@ -25,16 +25,12 @@ Notifications = { participants.forEach((userId) => { if (userMap[userId]) return; const user = Users.findOne(userId); - if (user && user.hasTag('notify-participate')) { - userMap[userId] = user; - } + userMap[userId] = user; }); watchers.forEach((userId) => { if (userMap[userId]) return; const user = Users.findOne(userId); - if (user && user.hasTag('notify-watch')) { - userMap[userId] = user; - } + userMap[userId] = user; }); return _.map(userMap, (v) => v); }, diff --git a/snap-src/bin/wekan-help b/snap-src/bin/wekan-help index 95814d36..3af19336 100755 --- a/snap-src/bin/wekan-help +++ b/snap-src/bin/wekan-help @@ -95,6 +95,156 @@ echo -e "\t$ snap set $SNAP_NAME OAUTH2_TOKEN_ENDPOINT='/oauth/token'" echo -e "\t-Disable the OAuth2 Token Endpoint of Wekan:" echo -e "\t$ snap set $SNAP_NAME OAUTH2_TOKEN_ENDPOINT=''" echo -e "\n" +echo -e "Ldap Enable." +echo -e "To enable the ldap of Wekan:" +echo -e "\t$ snap set $SNAP_NAME LDAP_ENABLE='true'" +echo -e "\t-Disable the ldap of Wekan:" +echo -e "\t$ snap set $SNAP_NAME LDAP_ENABLE='false'" +echo -e "\n" +echo -e "Ldap Port." +echo -e "The port of the ldap server:" +echo -e "\t$ snap set $SNAP_NAME LDAP_PORT='12345'" +echo -e "\n" +echo -e "Ldap Host." +echo -e "The host server for the LDAP server:" +echo -e "\t$ snap set $SNAP_NAME LDAP_HOST='localhost'" +echo -e "\n" +echo -e "Ldap Base Dn." +echo -e "The base DN for the LDAP Tree:" +echo -e "\t$ snap set $SNAP_NAME LDAP_BASEDN='ou=user,dc=example,dc=org'" +echo -e "\n" +echo -e "Ldap Login Fallback." +echo -e "Fallback on the default authentication method:" +echo -e "\t$ snap set $SNAP_NAME LDAP_LOGIN_FALLBACK='true'" +echo -e "\n" +echo -e "Ldap Reconnect." +echo -e "Reconnect to the server if the connection is lost:" +echo -e "\t$ snap set $SNAP_NAME LDAP_RECONNECT='false'" +echo -e "\n" +echo -e "Ldap Timeout." +echo -e "Overall timeout, in milliseconds:" +echo -e "\t$ snap set $SNAP_NAME LDAP_TIMEOUT='12345'" +echo -e "\n" +echo -e "Ldap Idle Timeout." +echo -e "Specifies the timeout for idle LDAP connections in milliseconds:" +echo -e "\t$ snap set $SNAP_NAME LDAP_IDLE_TIMEOUT='12345'" +echo -e "\n" +echo -e "Ldap Connect Timeout." +echo -e "Connection timeout, in milliseconds:" +echo -e "\t$ snap set $SNAP_NAME LDAP_CONNECT_TIMEOUT='12345'" +echo -e "\n" +echo -e "Ldap Authentication." +echo -e "If the LDAP needs a user account to search:" +echo -e "\t$ snap set $SNAP_NAME LDAP_AUTHENTIFICATION='true'" +echo -e "\n" +echo -e "Ldap Authentication User Dn." +echo -e "The search user Dn:" +echo -e "\t$ snap set $SNAP_NAME LDAP_AUTHENTIFICATION_USERDN='cn=admin,dc=example,dc=org'" +echo -e "\n" +echo -e "Ldap Authentication Password." +echo -e "The password for the search user:" +echo -e "\t$ snap set $SNAP_NAME AUTHENTIFICATION_PASSWORD='admin'" +echo -e "\n" +echo -e "Ldap Log Enabled." +echo -e "Enable logs for the module:" +echo -e "\t$ snap set $SNAP_NAME LDAP_LOG_ENABLED='true'" +echo -e "\n" +echo -e "Ldap Background Sync." +echo -e "If the sync of the users should be done in the background:" +echo -e "\t$ snap set $SNAP_NAME LDAP_BACKGROUND_SYNC='true'" +echo -e "\n" +echo -e "Ldap Background Sync Interval." +echo -e "At which interval does the background task sync in milliseconds:" +echo -e "\t$ snap set $SNAP_NAME LDAP_BACKGROUND_SYNC_INTERVAL='12345'" +echo -e "\n" +echo -e "Ldap Background Sync Keep Existant Users Updated." +echo -e "\t$ snap set $SNAP_NAME LDAP_BACKGROUND_SYNC_KEEP_EXISTANT_USERS_UPDATED='true'" +echo -e "\n" +echo -e "Ldap Background Sync Import New Users." +echo -e "\t$ snap set $SNAP_NAME LDAP_BACKGROUND_SYNC_IMPORT_NEW_USERS='true'" +echo -e "\n" +echo -e "Ldap Encryption." +echo -e "Allow LDAPS:" +echo -e "\t$ snap set $SNAP_NAME LDAP_ENCRYPTION='true'" +echo -e "\n" +echo -e "Ldap Ca Cert." +echo -e "The certification for the LDAPS server:" +echo -e "\t$ snap set $SNAP_NAME LDAP_CA_CERT=-----BEGIN CERTIFICATE-----MIIE+zCCA+OgAwIBAgIkAhwR/6TVLmdRY6hHxvUFWc0+Enmu/Hu6cj+G2FIdAgIC...-----END CERTIFICATE-----" +echo -e "\n" +echo -e "Ldap Reject Unauthorized." +echo -e "Reject Unauthorized Certificate:" +echo -e "\t$ snap set $SNAP_NAME LDAP_REJECT_UNAUTHORIZED='true'" +echo -e "\n" +echo -e "Ldap User Search Filter." +echo -e "Optional extra LDAP filters. Don't forget the outmost enclosing parentheses if needed:" +echo -e "\t$ snap set $SNAP_NAME LDAP_USER_SEARCH_FILTER=''" +echo -e "\n" +echo -e "Ldap User Search Scope." +echo -e "Base (search only in the provided DN), one (search only in the provided DN and one level deep), or subtree (search the whole subtree):" +echo -e "\t$ snap set $SNAP_NAME LDAP_USER_SEARCH_SCOPE=one" +echo -e "\n" +echo -e "Ldap User Search Field." +echo -e "Which field is used to find the user:" +echo -e "\t$ snap set $SNAP_NAME LDAP_USER_SEARCH_FIELD='uid'" +echo -e "\n" +echo -e "Ldap Search Page Size." +echo -e "Used for pagination (0=unlimited):" +echo -e "\t$ snap set $SNAP_NAME LDAP_SEARCH_PAGE_SIZE='12345'" +echo -e "\n" +echo -e "Ldap Search Size Limit." +echo -e "The limit number of entries (0=unlimited):" +echo -e "\t$ snap set $SNAP_NAME LDAP_SEARCH_SIZE_LIMIT='12345'" +echo -e "\n" +echo -e "Ldap Group Filter Enable." +echo -e "Enable group filtering:" +echo -e "\t$ snap set $SNAP_NAME LDAP_GROUP_FILTER_ENABLE='true'" +echo -e "\n" +echo -e "Ldap Group Filter ObjectClass." +echo -e "The object class for filtering:" +echo -e "\t$ snap set $SNAP_NAME LDAP_GROUP_FILTER_OBJECTCLASS='group'" +echo -e "\n" +echo -e "Ldap Group Filter Id Attribute." +echo -e "\t$ snap set $SNAP_NAME LDAP_GROUP_FILTER_GROUP_ID_ATTRIBUTE=''" +echo -e "\n" +echo -e "Ldap Group Filter Member Attribute." +echo -e "\t$ snap set $SNAP_NAME LDAP_GROUP_FILTER_GROUP_MEMBER_ATTRIBUTE=''" +echo -e "\n" +echo -e "Ldap Group Filter Member Format." +echo -e "\t$ snap set $SNAP_NAME LDAP_GROUP_FILTER_GROUP_MEMBER_FORMAT=''" +echo -e "\n" +echo -e "Ldap Group Filter Group Name." +echo -e "\t$ snap set $SNAP_NAME LDAP_GROUP_FILTER_GROUP_NAME=''" +echo -e "\n" +echo -e "Ldap Unique Identifier Field." +echo -e "This field is sometimes class GUID (Globally Unique Identifier):" +echo -e "\t$ snap set $SNAP_NAME LDAP_UNIQUE_IDENTIFIER_FIELD=guid" +echo -e "\n" +echo -e "Ldap Utf8 Names Slugify." +echo -e "Convert the username to utf8:" +echo -e "\t$ snap set $SNAP_NAME LDAP_UTF8_NAMES_SLUGIFY='false'" +echo -e "\n" +echo -e "Ldap Username Field." +echo -e "Which field contains the ldap username:" +echo -e "\t$ snap set $SNAP_NAME LDAP_USERNAME_FIELD='username'" +echo -e "\n" +echo -e "Ldap Merge Existing Users." +echo -e "\t$ snap set $SNAP_NAME LDAP_MERGE_EXISTING_USERS='true'" +echo -e "\n" +echo -e "Ldap Sync User Data." +echo -e "Enable synchronization of user data:" +echo -e "\t$ snap set $SNAP_NAME LDAP_SYNC_USER_DATA='true'" +echo -e "\n" +echo -e "Ldap Sync User Data Fieldmap." +echo -e "A field map for the matching:" +echo -e "\t$ snap set $SNAP_NAME LDAP_SYNC_USER_DATA_FIELDMAP={\"cn\":\"name\", \"mail\":\"email\"}" +echo -e "\n" +echo -e "Ldap Sync Group Roles." +echo -e "\t$ snap set $SNAP_NAME LDAP_SYNC_GROUP_ROLES=''" +echo -e "\n" +echo -e "Ldap Default Domain." +echo -e "The default domain of the ldap it is used to create email if the field is not map correctly with the LDAP_SYNC_USER_DATA_FIELDMAP:" +echo -e "\t$ snap set $SNAP_NAME LDAP_DEFAULT_DOMAIN=''" +echo -e "\n" # parse config file for supported settings keys echo -e "wekan supports settings keys" echo -e "values can be changed by calling\n$ snap set $SNAP_NAME =''" -- cgit v1.2.3-1-g7c22