Skip to content
Snippets Groups Projects
Commit 529d67ca authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Merge branch 'dd_msg_reader_multiple_msg_delete_hdr_fix' into 'master'

DDMsgReader: Bug fix for deleting multiple selected messages

See merge request !271
parents 4207f5fd cb31b8e9
No related branches found
No related tags found
No related merge requests found
...@@ -108,6 +108,10 @@ ...@@ -108,6 +108,10 @@
* so that screen updates work better after pausing output. * so that screen updates work better after pausing output.
* Also, when running a new message scan (not new-to-you), the current * Also, when running a new message scan (not new-to-you), the current
* sub-board being scanned is now outputted. * sub-board being scanned is now outputted.
* 2023-03-24 Eric Oulashin Version 1.69
* Bug fix for deleting multiple selected messages: When updating message
* headers in the cached arrays, don't try to save them back to the database,
* because that was already done (this avoids a 'header has expanded fields' error).
*/ */
   
"use strict"; "use strict";
...@@ -213,8 +217,8 @@ var ansiterm = require("ansiterm_lib.js", 'expand_ctrl_a'); ...@@ -213,8 +217,8 @@ var ansiterm = require("ansiterm_lib.js", 'expand_ctrl_a');
   
   
// Reader version information // Reader version information
var READER_VERSION = "1.68"; var READER_VERSION = "1.69";
var READER_DATE = "2023-03-15"; var READER_DATE = "2023-03-24";
   
// Keyboard key codes for displaying on the screen // Keyboard key codes for displaying on the screen
var UP_ARROW = ascii(24); var UP_ARROW = ascii(24);
...@@ -1686,15 +1690,20 @@ function msgNumToIdxFromMsgbase(pSubCode, pMsgNum) ...@@ -1686,15 +1690,20 @@ function msgNumToIdxFromMsgbase(pSubCode, pMsgNum)
// pApply: Optional boolean - Whether or not to apply the attribute or remove it. Defaults to true. // pApply: Optional boolean - Whether or not to apply the attribute or remove it. Defaults to true.
// pSubBoardCode: Optional - An internal sub-board code. If not specified, then // pSubBoardCode: Optional - An internal sub-board code. If not specified, then
// this method will default to this.subBoardCode. // this method will default to this.subBoardCode.
function DigDistMsgReader_RefreshSearchResultMsgHdr(pMsgIndex, pAttrib, pApply, pSubBoardCode) // pWriteHdrToMsgbase: Optional boolean - Whether or not to also save the message to the messagebase. Defaults to true.
function DigDistMsgReader_RefreshSearchResultMsgHdr(pMsgIndex, pAttrib, pApply, pSubBoardCode, pWriteHdrToMsgbase)
{ {
if (typeof(pMsgIndex) != "number") if (typeof(pMsgIndex) != "number")
return; return;
   
var applyAttr = (typeof(pApply) === "boolean" ? pApply : true); var applyAttr = (typeof(pApply) === "boolean" ? pApply : true);
var subCode = (typeof(pSubBoardCode) == "string" ? pSubBoardCode : this.subBoardCode); var subCode = (typeof(pSubBoardCode) === "string" ? pSubBoardCode : this.subBoardCode);
var writeHdrToMsgbase = (typeof(pWriteHdrToMsgbase) === "boolean" ? pWriteHdrToMsgbase : true);
var msgbase = new MsgBase(subCode); var msgbase = new MsgBase(subCode);
if (msgbase.open()) var continueOn = true;
if (writeHdrToMsgbase)
continueOn = msgbase.open();
if (continueOn)
{ {
if (this.msgSearchHdrs.hasOwnProperty(subCode)) if (this.msgSearchHdrs.hasOwnProperty(subCode))
{ {
...@@ -1707,8 +1716,11 @@ function DigDistMsgReader_RefreshSearchResultMsgHdr(pMsgIndex, pAttrib, pApply, ...@@ -1707,8 +1716,11 @@ function DigDistMsgReader_RefreshSearchResultMsgHdr(pMsgIndex, pAttrib, pApply,
this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex].attr = this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex].attr | pAttrib; this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex].attr = this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex].attr | pAttrib;
else else
this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex].attr = this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex].attr ^ pAttrib; this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex].attr = this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex].attr ^ pAttrib;
var msgOffsetFromHdr = this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex].offset; if (writeHdrToMsgbase)
msgbase.put_msg_header(true, msgOffsetFromHdr, this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex]); {
var msgOffsetFromHdr = this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex].offset;
msgbase.put_msg_header(true, msgOffsetFromHdr, this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex]);
}
} }
} }
else else
...@@ -1717,11 +1729,13 @@ function DigDistMsgReader_RefreshSearchResultMsgHdr(pMsgIndex, pAttrib, pApply, ...@@ -1717,11 +1729,13 @@ function DigDistMsgReader_RefreshSearchResultMsgHdr(pMsgIndex, pAttrib, pApply,
if (this.msgSearchHdrs[this.subBoardCode].indexed.hasOwnProperty(pMsgIndex)) if (this.msgSearchHdrs[this.subBoardCode].indexed.hasOwnProperty(pMsgIndex))
{ {
this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex] = msgHeader; this.msgSearchHdrs[this.subBoardCode].indexed[pMsgIndex] = msgHeader;
msgbase.put_msg_header(true, msgHeader.offset, msgHeader); if (writeHdrToMsgbase)
msgbase.put_msg_header(true, msgHeader.offset, msgHeader);
} }
} }
} }
msgbase.close(); if (writeHdrToMsgbase)
msgbase.close();
} }
} }
   
...@@ -1758,10 +1772,11 @@ function DigDistMsgReader_RefreshHdrInSubBoardHdrs(pMsgIndex, pAttrib, pApply) ...@@ -1758,10 +1772,11 @@ function DigDistMsgReader_RefreshHdrInSubBoardHdrs(pMsgIndex, pAttrib, pApply)
// pApply: Optional boolean - Whether or not to apply the attribute or remove it. Defaults to true. // pApply: Optional boolean - Whether or not to apply the attribute or remove it. Defaults to true.
// pSubBoardCode: Optional - An internal sub-board code. If not specified, then // pSubBoardCode: Optional - An internal sub-board code. If not specified, then
// this method will default to this.subBoardCode. // this method will default to this.subBoardCode.
function DigDistMsgReader_RefreshHdrInSavedArrays(pMsgIndex, pAttrib, pApply, pSubBoardCode) // pWriteHdrToMsgbase: Optional boolean - Whether or not to also save the message to the messagebase. Defaults to true.
function DigDistMsgReader_RefreshHdrInSavedArrays(pMsgIndex, pAttrib, pApply, pSubBoardCode, pWriteHdrToMsgbase)
{ {
var applyAttr = (typeof(pApply) === "boolean" ? pApply : true); var applyAttr = (typeof(pApply) === "boolean" ? pApply : true);
this.RefreshSearchResultMsgHdr(pMsgIndex, pAttrib, applyAttr, pSubBoardCode); this.RefreshSearchResultMsgHdr(pMsgIndex, pAttrib, applyAttr, pSubBoardCode, pWriteHdrToMsgbase);
this.RefreshHdrInSubBoardHdrs(pMsgIndex, pAttrib, applyAttr); this.RefreshHdrInSubBoardHdrs(pMsgIndex, pAttrib, applyAttr);
} }
   
...@@ -14317,7 +14332,7 @@ function DigDistMsgReader_DeleteOrUndeleteSelectedMessages(pDelete) ...@@ -14317,7 +14332,7 @@ function DigDistMsgReader_DeleteOrUndeleteSelectedMessages(pDelete)
// Refresh the message header in the header arrays (if it exists there) and // Refresh the message header in the header arrays (if it exists there) and
// remove the message index from the selectedMessages object. Also, delete // remove the message index from the selectedMessages object. Also, delete
// or undelete any vote response messages that may exist for this message. // or undelete any vote response messages that may exist for this message.
this.RefreshHdrInSavedArrays(msgIdxNumber, MSG_DELETE, markAsDeleted, subBoardCode); this.RefreshHdrInSavedArrays(msgIdxNumber, MSG_DELETE, markAsDeleted, subBoardCode, false);
var voteDelRetObj = toggleVoteMsgsDeleted(msgBase, msgHdr.number, msgHdr.id, markAsDeleted, (subBoardCode == "mail")); var voteDelRetObj = toggleVoteMsgsDeleted(msgBase, msgHdr.number, msgHdr.id, markAsDeleted, (subBoardCode == "mail"));
if (!voteDelRetObj.allVoteMsgsAffected) if (!voteDelRetObj.allVoteMsgsAffected)
{ {
......
Digital Distortion Message Reader Digital Distortion Message Reader
Version 1.68 Version 1.69
Release date: 2023-03-15 Release date: 2023-03-24
by by
......
...@@ -5,6 +5,11 @@ Revision History (change log) ...@@ -5,6 +5,11 @@ Revision History (change log)
============================= =============================
Version Date Description Version Date Description
------- ---- ----------- ------- ---- -----------
1.69 2023-03-24 Bug fix for deleting multiple selected messages: When
updating message headers in the cached arrays, don't try
to save them back to the database, because that was
already done (this avoids a 'header has expanded fields'
error).
1.68 2023-03-15 Makes use of console.aborted when displaying help screens 1.68 2023-03-15 Makes use of console.aborted when displaying help screens
so that screen updates work better after pausing output. so that screen updates work better after pausing output.
Also, when running a new message scan (not new-to-you), Also, when running a new message scan (not new-to-you),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment