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