FIX: Less safe API for icons

This commit is contained in:
Robin Ward 2016-02-19 16:03:26 -05:00
parent 8b318f76a1
commit 9b0b213ba2
1 changed files with 6 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import { includeAttributes } from 'discourse/lib/transform-post';
import { addToolbarCallback } from 'discourse/components/d-editor';
import { addWidgetCleanCallback } from 'discourse/components/mount-widget';
import { decorateWidget } from 'discourse/widgets/widget';
import PageTracker from 'discourse/lib/page-tracker';
let _decorateId = 0;
function decorate(klass, evt, cb) {
@ -84,7 +85,7 @@ class PluginApi {
**/
addPosterIcon(cb) {
decorateWidget('poster-name:after', (h, attrs) => {
const result = cb(attrs.userCustomFields, attrs);
const result = cb(attrs.userCustomFields || {}, attrs);
if (result) {
let iconBody;
@ -138,6 +139,10 @@ class PluginApi {
addWidgetCleanCallback('post-stream', fn);
}
onPageChange(fn) {
PageTracker.current().on('change', fn);
}
}
let _pluginv01;