Fix error when starring a post for starboard

This commit is contained in:
Dragory 2020-07-29 20:08:41 +03:00
parent dc25b67672
commit 49559c14fd
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 11 additions and 20 deletions

View file

@ -1,19 +0,0 @@
import { TStarboardOpts, StarboardPluginType, defaultStarboardOpts } from "../types";
import { PluginData } from "knub";
export function getStarboardOptsForStarboardChannel(
pluginData: PluginData<StarboardPluginType>,
starboardChannel,
): TStarboardOpts[] {
const config = pluginData.config.getForChannel(starboardChannel);
const configs = Object.values(config.boards).filter(opts => opts.channel_id === starboardChannel.id);
configs.forEach(cfg => {
if (cfg.enabled == null) cfg.enabled = defaultStarboardOpts.enabled;
if (cfg.star_emoji == null) cfg.star_emoji = defaultStarboardOpts.star_emoji;
if (cfg.stars_required == null) cfg.stars_required = defaultStarboardOpts.stars_required;
if (cfg.copy_full_embed == null) cfg.copy_full_embed = false;
});
return configs;
}