Open BadDevilGrind opened 4 months ago
Actually managed to fix it myself. I created a filter array in the read function.
I added const messageList = mailList.filter( (mail) => mail.to.includes( userDatabase.userId ) );
to the read function in kernel.js, and changed mailAtIndex to reference the messageList instead of mailList
Hi @BadDevilGrind
Thank you for the bug report! I missed it when you created this issue last month, maybe because you closed it quickly after.
I'm reopining it until it is properly fixed on our side, give that it also caused trouble to @Chamo1 in issue https://github.com/jacksonbenete/email_terminal/issues/45
Would you like to submit a Pull Request o integrate this fixup into https://github.com/jacksonbenete/email_terminal master
branch?
Else I can handle it 🙂
As the title describes, the read program utilizes the absolute array index for reading emails, instead of utilized the localised array created by the "mail" program.
This means that if I have set up mails for several users on the same server, they will get the following output from mail.
User 1:
[1]: "Please call me"
User 2: 0: "What are you doing saturday night?"
Assuming those are the only emails in the mailserver.json file, and in the order specified, it will work for User 1 to type either read 0 or read 1 and get the corresponding message, but whenever User 2 tries to write read 0, it gets an error message, and only by typing read 2 (as it is the third mail in the json) the user gets the mail.