当用户是用数字注册时,会出现解析失败的bug。
/u/解析
解析可以是用户名和id,所以将用户名人称id就出bugLe ,有什么解决方法么

    mzh 这是个bug,已在计划修复中,目前可以强制使用 uid 访问用户链接来避免报错

    • mzh 回复了此帖
      sed -i "s#a-z0-9_-#-_a-z0-9\\\x7f-\\\xff#" \
        vendor/flarum/core/src/User/UserValidator.php
      • mzh 回复了此帖

        mzh 他给你的是允许中文用户名注册的命令,与你的问题无关。
        你要的解决方法是这个,命令行运行就行了

        # 个人主页链接仅支持 UID
        sed -i 's#username:e\.username#username:e.id#g' \
          vendor/flarum/core/js/dist/forum.js \
        	vendor/flarum/mentions/js/dist/forum.js

          Golden 该修补方法会导致私人讨论功能失效

          Uncaught TypeError: Cannot read property 'id' of undefined
              at e.F.addDefaultRecipients (addRecipientComposer.js:21)
              at e.n.init (PrivateDiscussionComposer.js:12)
              at e.t (Component.js:65)
              at e [as constructor] (forum-51f1176b.js:52)
              at e [as constructor] (forum-51f1176b.js:52)
              at new e (forum-51f1176b.js:9928)
              at HTMLButtonElement.onclick (addDiscussPrivatelyControl.js:27)
              at HTMLButtonElement.H.t.<computed> (mithril.js:1286)
          Composer.js:297 Uncaught TypeError: Cannot read property 'focus' of undefined
              at HTMLDivElement.<anonymous> (Composer.js:297)
              at HTMLDivElement.i.complete (jquery.js:7489)
              at u (jquery.js:3291)
              at Object.fireWith [as resolveWith] (jquery.js:3421)
              at u (jquery.js:7332)
              at Function.N.fx.tick (jquery.js:7655)
              at de (jquery.js:7035)
          • mzh 觉得很赞