Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Junk/NotJunk flags #10328

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/Service/MailManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ class MailManager implements IMailManager {
private const ALLOWED_FLAGS = [
'seen' => [Horde_Imap_Client::FLAG_SEEN],
'answered' => [Horde_Imap_Client::FLAG_ANSWERED],
'forwarded' => [Horde_Imap_Client::FLAG_FORWARDED],
'flagged' => [Horde_Imap_Client::FLAG_FLAGGED],
'deleted' => [Horde_Imap_Client::FLAG_DELETED],
'draft' => [Horde_Imap_Client::FLAG_DRAFT],
'recent' => [Horde_Imap_Client::FLAG_RECENT],
'junk' => [Horde_Imap_Client::FLAG_JUNK, 'junk'],
'junk' => [Horde_Imap_Client::FLAG_JUNK],
'notjunk' => [Horde_Imap_Client::FLAG_NOTJUNK,],
'mdnsent' => [Horde_Imap_Client::FLAG_MDNSENT],
];

Expand Down
4 changes: 2 additions & 2 deletions src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -998,8 +998,8 @@ export default {

try {
await setEnvelopeFlags(envelope.databaseId, {
$junk: !oldState,
$notjunk: oldState,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flag: '$notjunk',
,

mail/src/store/actions.js

Lines 1011 to 1021 in 1d5e5b4

// Revert change
commit('flagEnvelope', {
envelope,
flag: '$junk',
value: oldState,
})
commit('flagEnvelope', {
envelope,
flag: '$notjunk',
value: !oldState,
})
and similar stay?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, The UI handles the "$junk" but the backend compares the it as "junk", so in the UI they can all stay as "$junk" but need to have the $ sign stripped of when sent to the backend. The second image of allowed flags is comparison table, the first image is how they are compared/found.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you point me to the code that strips the $?

junk: !oldState,
notjunk: oldState,
})
} catch (error) {
console.error('could not toggle message junk state', error)
Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/Service/MailManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,13 @@ public function testFilterFlagStandard(): void {
$flags = [
'seen' => [\Horde_Imap_Client::FLAG_SEEN],
'answered' => [\Horde_Imap_Client::FLAG_ANSWERED],
'forwarded' => [\Horde_Imap_Client::FLAG_FORWARDED],
'flagged' => [\Horde_Imap_Client::FLAG_FLAGGED],
'deleted' => [\Horde_Imap_Client::FLAG_DELETED],
'draft' => [\Horde_Imap_Client::FLAG_DRAFT],
'recent' => [\Horde_Imap_Client::FLAG_RECENT],
'junk' => [\Horde_Imap_Client::FLAG_JUNK, 'junk'],
'junk' => [\Horde_Imap_Client::FLAG_JUNK],
'notjunk' => [\Horde_Imap_Client::FLAG_NOTJUNK],
'mdnsent' => [\Horde_Imap_Client::FLAG_MDNSENT],
];

Expand Down
Loading