Fix tag change event posts with deleted tags erroring (#66)

Fixes #1864
This commit is contained in:
David Sevilla Martín 2019-10-01 20:02:45 -04:00 committed by Franz Liedke
parent 7832c7c48c
commit e59c54eae0

View File

@ -6,7 +6,7 @@ export default function tagLabel(tag, attrs = {}) {
attrs.className = 'TagLabel ' + (attrs.className || '');
const link = extract(attrs, 'link');
let tagText = tag ? tag.name() : app.translator.trans('flarum-tags.lib.deleted_tag_text');
const tagText = tag ? tag.name() : app.translator.trans('flarum-tags.lib.deleted_tag_text');
if (tag) {
const color = tag.color();
@ -23,10 +23,11 @@ export default function tagLabel(tag, attrs = {}) {
} else {
attrs.className += ' untagged';
}
return (
m((link ? 'a' : 'span'), attrs,
<span className="TagLabel-text">
{tag.icon() && tagIcon(tag, {}, {useColor: false})} {tagText}
{tag && tag.icon() && tagIcon(tag, {}, {useColor: false})} {tagText}
</span>
)
);