-
Notifications
You must be signed in to change notification settings - Fork 15
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
Convert spam
role to junk
#89
Conversation
This will allow adding tests that have different expected results
This will improve compatibility with clients and servers not following the spec
This is somehow unrelated, but could you explain why the This would avoid the equatable mixin and lessen memory usage? See https://dartpad.dev/?id=ab64c61ac6bc10e6b0c577656da73781 |
We use Please run code on dartpad to see result import 'package:equatable/equatable.dart';
class RoleA with EquatableMixin {
final String value;
RoleA(value) : value = value == "spam" ? "junk" : value;
@override
List<Object?> get props => [value];
}
class RoleB {
final String value;
const RoleB(value) : value = value == "spam" ? "junk" : value;
}
void main() {
final junkA = RoleA("junk");
final spamA = RoleA("spam");
const junkB = RoleB("junk");
const spamB = RoleB("spam");
print('junkA == spamA ${junkA == spamA}');
print('junkB == spamB ${junkB == spamB}');
print('identical(junkA, spamA) ${identical(junkA, spamA)}');
print('identical(junkB, spamB) ${identical(junkB, spamB)}');
} |
Hi @jip149, can you give me some examples of problem with it? |
@hoangdat this is related to tmail-flutter issue #2894 I'll try to test today if the patch indeed work as expected. @dab246 Thank you for your reply. I understand how equatable and identical work. My question is, why not use compile time constants for Role objects? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the contribution!
I managed to compile TwakeMail using flutter 3.16. I have not yet fully tested all Spam related functions, but I confirm the correct folder is now used with Stalwart. I'll do some more testing with Stalwart. Can you test that it still works with JAMES? |
We've been developing it for quite some time, and at that time we thought it might need to change its property values after initialization, so we didn't set |
Yes, still work. |
Thanks, that makes sense. What I said was actually a mistake: since Thanks again for your patience and explanations, it's much more clearer now. |
Hi, @jip149 , we had one side effect
With your change, |
Hello @hoangdat! Thank you very much for your feedback. Can you tell me more precisely what doesn't work and how I can reproduce the problem? I suspect the problem comes from the capital 'S' at the beginning of |
According to the JMAP specification, the role for the Spam/Junk mailbox should be
junk
. However, some servers and client incorrectly usespam
role (which does not exist in the spec).This PR modifies the
Role
constructor to treat thespam
role asjunk
.Tests have been updated and written, however, it has not yet been tested in TwakeMail (work in progress).