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

Conversation

SebastianKrupinski
Copy link
Contributor

Issue

Junk and NotJunk flags where not being set due to a invalid comparison. UI was sending "$junk" but it was being compared to "junk".

Screenshot 2024-11-05 181610

Allowed flags was also missing "notjunk"

image

Signed-off-by: SebastianKrupinski <[email protected]>
@ChristophWurst
Copy link
Member

How do we test this?

Found #5370 to change junk to $junk

@@ -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 $?

@SebastianKrupinski
Copy link
Contributor Author

SebastianKrupinski commented Nov 6, 2024

How do we test this?

The best way to test is to insert a break point in the OCA\Mail\Service\MailManager::filterFlags() function. That way you can see the values for the table and flag.

Found #5370 to change junk to $junk

This correctly added the front end logic,

commit('flagEnvelope', {
	envelope,
	flag: 'junk',
	flag: '$junk',
	value: !oldState,
})
commit('flagEnvelope', {
	envelope,
	flag: '$notjunk',
	value: !oldState,
})

But incorrectly changed the back end logic,

setEnvelopeFlag(envelope.databaseId, '$junk', !oldState).catch((e) => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗️ In progress
Development

Successfully merging this pull request may close these issues.

2 participants