ruby / net-imap

Ruby client api for Internet Message Access Protocol
https://ruby.github.io/net-imap
Other
56 stars 29 forks source link

Frozen SearchResult breaks IMAP.find with what: :last option #262

Closed stanley90 closed 8 months ago

stanley90 commented 8 months ago

PR #236 introduced the SearchResult class, which is actually a frozen Array. However, this breaks the what: :last option in the mail gem here FrozenError: can't modify frozen Net::IMAP::SearchResult

nevans commented 8 months ago

Thanks for reporting this. I should have realized that freezing by default wouldn't be backward compatible! That's fixed by #263.

I'm hoping that using the subclass is still okay though. I'd prefer not to add a config option (e.g: search_result_type => Array | SearchResult | ESearchResult) and I'd prefer to return the same type regardless of whether or not we see a MODSEQ. What do you think?

stanley90 commented 8 months ago

Honestly, I'm not convinced that the mail gem should just reverse! it in place, safer would be to make a copy. Otherwise I guess an Array subclass is okay. Btw, can I expect a release rather soon? Need to decide whether to temporarily work around this / downgrade 🙂

nevans commented 8 months ago

Honestly, I'm not convinced that the mail gem should just reverse! it in place, safer would be to make a copy. Otherwise I guess an Array subclass is okay.

I would prefer that too. But backward compatibility is more important, especially since there were no deprecation warnings.

Btw, can I expect a release rather soon? Need to decide whether to temporarily work around this / downgrade 🙂

Yes, today or tomorrow. 🙂

nevans commented 8 months ago

@stanley90 It's been released. Let me know if v0.4.10 works for you.

stanley90 commented 8 months ago

@stanley90 It's been released. Let me know if v0.4.10 works for you.

Works, thanks!

PaulinaCarrilloRuiz09 commented 7 months ago

💯