Current Behavior
If the slug driver is set to something different than username, Flarum will crash with a javascript error when clicking the "Start private discussion" link on a user profile
Steps to Reproduce
Set user slug driver to ID
Visit any user profile
Use dropdown button to start private discussion with user
Error loosely transcripted from screenshot:
TypeError: Cannot read properties of undefined (reading 'id') at addDefaultRecipients (PrivateDiscussionComposer.js)
Expected Behavior
Should work with any slug driver.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
Flarum version: 1.4.0
Extension version: master
Output of "php flarum info", run this in terminal in your Flarum directory.
Bug Report
Current Behavior If the slug driver is set to something different than username, Flarum will crash with a javascript error when clicking the "Start private discussion" link on a user profile
Steps to Reproduce
Error loosely transcripted from screenshot:
Expected Behavior Should work with any slug driver.
Screenshots If applicable, add screenshots to help explain your problem.
Environment
Possible solution(s) https://github.com/FriendsOfFlarum/byobu/blob/bc5dafa1987b8a8b967374f6903a3cd56c08f553/js/src/forum/pages/discussions/PrivateDiscussionComposer.js#L107
I think just replacing
'username'
with'slug'
as the second parameter should fix it.This would probably be a good opportunity to gracefully handle
null
being returned bygetBy
even though it supposedly shouldn't happen.Additional Context Based on report here https://discuss.flarum.org/d/4762-friendsofflarum-by-bu-well-integrated-advanced-private-discussions/1166