Explorar o código

update comment mention helper

ryoji-s %!s(int64=3) %!d(string=hai) anos
pai
achega
c3566f854c

+ 2 - 2
packages/app/src/components/PageEditor/CommentMentionHelper.ts

@@ -4,7 +4,6 @@ import { debounce } from 'throttle-debounce';
 
 
 import { apiv3Get } from '~/client/util/apiv3-client';
 import { apiv3Get } from '~/client/util/apiv3-client';
 
 
-
 type UsersListForHints = {
 type UsersListForHints = {
   text: string
   text: string
   displayText: string
   displayText: string
@@ -42,7 +41,8 @@ export default class CommentMentionHelper {
         if (mention.length > 0) {
         if (mention.length > 0) {
           const users = await this.getUsersList(mention);
           const users = await this.getUsersList(mention);
           return {
           return {
-            list: users.length > 0 ? users : [{ text: '', displayText: i18n?.t('page_comment.no_user_found') }],
+            // Returns default value if i18n is null because it cannot do early return.
+            list: users.length > 0 ? users : [{ text: '', displayText: i18n != null ? i18n.t('page_comment.no_user_found') : 'No user found' }],
             from: searchFrom,
             from: searchFrom,
             to: searchTo,
             to: searchTo,
           };
           };