WildcardSearch / MentionMe

A plugin for MyBB 1.8.x that allows Twitter-style tagging and integration with MyAlerts
GNU General Public License v3.0
21 stars 9 forks source link

Error with showing avatars #221

Closed burnacid closed 6 years ago

burnacid commented 6 years ago

When I switch on avatars I'm getting an error on autocomplete.min.js line 30

Uncaught TypeError: Cannot read property 'length' of undefined at MentionMeAutoCompletePopup.buildItems (autocomplete.min.js:30) at MentionMeAutoCompletePopup.update (autocomplete.min.js:23) at MentionMeAutoCompletePopup.show (autocomplete.min.js:16) at AutoCompleteTextareaInterface.showPopup (autocomplete.min.js:112) at AutoCompleteTextareaInterface.onKeyUp (autocomplete.min.js:111) at HTMLTextAreaElement.d (jquery.js?ver=1806:2) at HTMLTextAreaElement.dispatch (jquery.js?ver=1806:3) at HTMLTextAreaElement.r.handle (jquery.js?ver=1806:3)

burnacid commented 6 years ago

Line 301 of the autocomplete.js

avatarPath = data[user]["avatar"];

avatar is undefined for some reason

burnacid commented 6 years ago

I've fixed it in the following way Line 301 of the autocomplete.js

if (typeof avatarPath == 'undefined'){
    avatarPath = options.defaultAvatar;
}else if (avatarPath.length == 0) {
    avatarPath = options.defaultAvatar;
}
WildcardSearch commented 6 years ago

PR merged!