}
protected _markReactionAsActive(): void {
- let reactionTypeID = 0;
+ let reactionTypeID: number | null = null;
this._objects.get(this._popoverCurrentObjectId)!.forEach((element) => {
if (element.reactButton !== null) {
reactionTypeID = ~~element.reactButton.dataset.reactionTypeId!;
}
});
- if (!reactionTypeID) {
+ if (reactionTypeID === null) {
throw new Error("Unable to find react button for current popover.");
}
const scrollableContainer = popover.querySelector(".reactionPopoverContent") as HTMLElement;
if (reactionTypeID) {
const reactionTypeButton = popover.querySelector(
- `.reactionTypeButton[data-reaction-type-id="${reactionTypeID}"]`,
+ `.reactionTypeButton[data-reaction-type-id="${reactionTypeID!}"]`,
) as HTMLElement;
reactionTypeButton.classList.add("active");
});
}
_markReactionAsActive() {
- let reactionTypeID = 0;
+ let reactionTypeID = null;
this._objects.get(this._popoverCurrentObjectId).forEach((element) => {
if (element.reactButton !== null) {
reactionTypeID = ~~element.reactButton.dataset.reactionTypeId;
}
});
- if (!reactionTypeID) {
+ if (reactionTypeID === null) {
throw new Error("Unable to find react button for current popover.");
}
// Clear the old active state.