From 6b2a658dbbd653067b4f4d7a208ac966dacdfc83 Mon Sep 17 00:00:00 2001 From: Eric Oulashin <eric.oulashin@gmail.com> Date: Fri, 2 Apr 2021 21:57:05 -0700 Subject: [PATCH] Version 1.11: When configured to use all available sub-boards, still don't allow choosing a sub-board that has polls disabled. This fixes an issue where SlyVote was showing all available message groups but some could be empty due to having no sub-boards that allow polls. --- xtrn/slyvote/readme.txt | 4 +-- xtrn/slyvote/slyvote.js | 55 +++++++++++++++++------------------------ 2 files changed, 24 insertions(+), 35 deletions(-) diff --git a/xtrn/slyvote/readme.txt b/xtrn/slyvote/readme.txt index 8cfc200107..696920a865 100644 --- a/xtrn/slyvote/readme.txt +++ b/xtrn/slyvote/readme.txt @@ -1,6 +1,6 @@ SlyVote - Version 1.10 - Release date: 2020-05-22 + Version 1.11 + Release date: 2021-04-02 by diff --git a/xtrn/slyvote/slyvote.js b/xtrn/slyvote/slyvote.js index c41ab28906..38500be11a 100644 --- a/xtrn/slyvote/slyvote.js +++ b/xtrn/slyvote/slyvote.js @@ -171,6 +171,13 @@ * useAllAvailableSubBoards 'false' setting was being * ignored when it was set to false when changing * to another sub-board. + * 2021-04-02 Eric Oulashin Version 1.11 + * When configured to use all available sub-boards, + * still don't allow choosing a sub-board that has + * polls disabled. This fixes an issue where SlyVote + * was showing all available message groups but + * some could be empty due to having no sub-boards + * that allow polls. */ // TODO: Have a messsage group selection so that it doesn't have to display all @@ -240,8 +247,8 @@ else var gAvatar = load({}, "avatar_lib.js"); // Version information -var SLYVOTE_VERSION = "1.10"; -var SLYVOTE_DATE = "2020-05-22"; +var SLYVOTE_VERSION = "1.11"; +var SLYVOTE_DATE = "2021-04-02"; // Determine the script's startup directory. // This code is a trick that was created by Deuce, suggested by Rob Swindell @@ -616,38 +623,20 @@ function CreateMsgGrpMenu(pListTopRow, pDrawColRetObj, pMsgGrps) grpMenu.ampersandHotkeysInItems = false; grpMenu.scrollbarEnabled = true; grpMenu.AddAdditionalQuitKeys("qQ"); - if (gSlyVoteCfg.useAllAvailableSubBoards) - { - grpMenu.NumItems = function() { - return msg_area.grp_list.length; - }; - grpMenu.GetItem = function(pItemIndex) { - var menuItemObj = this.MakeItemWithRetval(-1); - if ((pItemIndex >= 0) && (pItemIndex < msg_area.grp_list.length)) - { - menuItemObj.text = msg_area.grp_list[pItemIndex].name; - menuItemObj.retval = pItemIndex; - } - return menuItemObj; - }; - } - else + var grpNameLen = pDrawColRetObj.textLen - 2; + // Count the number of groups. If it's more than the number per page in + // the menu, then subtract 1 from grpNameLen to account for the scrollbar. + var numGrps = 0; + for (var grpIdx in pMsgGrps) + ++numGrps; + if (numGrps > grpMenu.GetNumItemsPerPage()) + --grpNameLen; + // Add the groups to the menu + for (var grpIdx in pMsgGrps) { - var grpNameLen = pDrawColRetObj.textLen - 2; - // Count the number of groups. If it's more than the number per page in - // the menu, then subtract 1 from grpNameLen to account for the scrollbar. - var numGrps = 0; - for (var grpIdx in pMsgGrps) - ++numGrps; - if (numGrps > grpMenu.GetNumItemsPerPage()) - --grpNameLen; - // Add the groups to the menu - for (var grpIdx in pMsgGrps) - { - var grpName = msg_area.grp_list[grpIdx].name; - var itemText = format("%-" + grpNameLen + "s", grpName.substr(0, grpNameLen)); - grpMenu.Add(itemText, grpIdx); - } + var grpName = msg_area.grp_list[grpIdx].name; + var itemText = format("%-" + grpNameLen + "s", grpName.substr(0, grpNameLen)); + grpMenu.Add(itemText, grpIdx); } return grpMenu; } -- GitLab