浏览代码

add full name if exists in email-invite-subject or when tagging someone with '@' while commenting a card

Emile NDAGIJIMANA 3 年之前
父节点
当前提交
d9329a9e15

+ 4 - 2
client/components/main/editor.js

@@ -17,8 +17,10 @@ Template.editor.onRendered(() => {
           currentBoard
             .activeMembers()
             .map(member => {
-              const username = Users.findOne(member.userId).username;
-              return username.includes(term) ? username : null;
+              const user = Users.findOne(member.userId);
+              const username = user.username;
+              const fullName = user.profile && user.profile !== undefined ?  user.profile.fullname : "";
+              return username.includes(term) || fullName.includes(term) ?  fullName + "(" + username + ")" : null;
             })
             .filter(Boolean), [...specialHandleNames])
         );

+ 3 - 2
client/components/main/layouts.jade

@@ -34,8 +34,9 @@ template(name="userFormsLayout")
           img(src="{{currentSetting.customLoginLogoImageUrl}}" width="300" height="auto")
           br
       unless currentSetting.customLoginLogoImageUrl
-        img(src="{{pathFor '/wekan-logo.svg'}}" alt="" width="300" height="auto")
-        br
+        if isSettingDatabaseFctCallDone
+          img(src="{{pathFor '/wekan-logo.svg'}}" alt="" width="300" height="auto")
+          br
       if currentSetting.textBelowCustomLoginLogo
         +viewer
           | {{currentSetting.textBelowCustomLoginLogo}}

+ 8 - 0
client/components/main/layouts.js

@@ -23,6 +23,8 @@ const validator = {
   },
 };
 
+let isSettingDatabaseFctCallDone = false;
+
 Template.userFormsLayout.onCreated(function() {
   const templateInstance = this;
   templateInstance.currentSetting = new ReactiveVar();
@@ -37,6 +39,8 @@ Template.userFormsLayout.onCreated(function() {
         let htmlvalue = "<i class='fa fa-oidc'></i>" + currSetting.oidcBtnText;
         oidcBtnElt.html(htmlvalue);
       }
+
+      isSettingDatabaseFctCallDone = true;
       return this.stop();
     },
   });
@@ -65,6 +69,10 @@ Template.userFormsLayout.helpers({
     return Template.instance().currentSetting.get();
   },
 
+  isSettingDatabaseCallDone(){
+    return isSettingDatabaseFctCallDone;
+  },
+
   isLoading() {
     return Template.instance().isLoading.get();
   },

+ 1 - 1
client/components/users/userHeader.js

@@ -25,7 +25,7 @@ Template.memberMenuPopup.helpers({
   isNotOAuth2AuthenticationMethod(){
     currentUser = Meteor.user();
     if (currentUser) {
-      return currentUser.authenticationMethod != 'OAuth2';
+      return currentUser.authenticationMethod.toLowerCase() != 'oauth2';
     } else {
       return true;
     }

+ 5 - 1
models/settings.js

@@ -217,9 +217,13 @@ if (Meteor.isServer) {
     const icode = InvitationCodes.findOne(_id);
     const author = Users.findOne(Meteor.userId());
     try {
+      const fullName = Users.findOne(icode.authorId)
+                  && Users.findOne(icode.authorId).profile
+                  && Users.findOne(icode.authorId).profile !== undefined ?  Users.findOne(icode.authorId).profile.fullname : "";
+
       const params = {
         email: icode.email,
-        inviter: Users.findOne(icode.authorId).username,
+        inviter: fullName != "" ? fullName + " (" + Users.findOne(icode.authorId).username + " )" : Users.findOne(icode.authorId).username,
         user: icode.email.split('@')[0],
         icode: icode.code,
         url: FlowRouter.url('sign-up'),

+ 2 - 1
models/users.js

@@ -1237,9 +1237,10 @@ if (Meteor.isServer) {
       }
 
       try {
+        const fullName = inviter.profile !== undefined ?  inviter.profile.fullname : "";
         const params = {
           user: user.username,
-          inviter: inviter.username,
+          inviter: fullName != "" ? fullName + " (" + inviter.username + " )" : inviter.username,
           board: board.title,
           url: board.absoluteUrl(),
         };