I’ve got one more thing that I need a hand with in order to fully complete this. It is a bit cheeky to ask, I know.
I’m now trying to modify the Pavilion so that it can support this behaviour too, using the simple logic from your three awesome snippets. However, I just can’t get it to work due to my ineptitude with javascript. This is what I’m trying to modify:
createWidget('layouts-group-link', {
tagName: 'li.layouts-group-link',
buildKey: (attrs) => `layouts-group-link-${attrs.id}`,
getGroupTitle(group) {
return h('span.group-title', group.name);
},
isOwner(group) {
if (group.owner) {
return h('span.group-owner-icon', iconNode('shield-alt'));
}
},
html(attrs) {
const contents = [this.getGroupTitle(attrs), this.isOwner(attrs)];
return contents;
},
click() {
DiscourseURL.routeTo(`/g/${this.attrs.name}/messages`);
},
});
How do I apply the bit below to that? I’ve tried everything that I could think of to the last click(){etc} bit but have failed. I just end up breaking the link completely.
if (group.is_group_user && group.has_messages) {
groupURL = `${groupURL}/messages/`;
}