Properly returning no description if the channel description is empty
parent
4c1774a394
commit
b9f23ca6cc
|
@ -346,10 +346,15 @@ export class ChannelEntry extends ChannelTreeEntry<ChannelEvents> {
|
|||
}
|
||||
}
|
||||
|
||||
if(!this.properties.channel_description) {
|
||||
return { status: "empty" };
|
||||
}
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
description: this.properties.channel_description
|
||||
}
|
||||
description: this.properties.channel_description,
|
||||
handlerId: this.channelTree.client.handlerId
|
||||
};
|
||||
}
|
||||
|
||||
isDescriptionCached() {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
export type ChannelDescriptionResult = {
|
||||
status: "success",
|
||||
description: string,
|
||||
|
||||
/* The handler id is required for BBCode renderers */
|
||||
handlerId: string
|
||||
} | {
|
||||
status: "empty"
|
||||
|
|
|
@ -112,14 +112,7 @@ class Controller {
|
|||
}));
|
||||
this.variables.setVariableProvider("password", () => this.channel.properties.channel_flag_password);
|
||||
this.variables.setVariableProvider("topic", () => this.channel.properties.channel_topic);
|
||||
this.variables.setVariableProvider("description", async () => {
|
||||
const result = _.cloneDeep(await this.channel.getChannelDescription(false));
|
||||
if(result.status === "success") {
|
||||
result.handlerId = this.channel.channelTree.client.handlerId;
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
this.variables.setVariableProvider("description", async () => await this.channel.getChannelDescription(false));
|
||||
|
||||
this.events.on("action_reload_description", () => {
|
||||
this.channel.clearDescriptionCache();
|
||||
|
|
Loading…
Reference in New Issue