Repository navigation
fix(new): add fallback to legacy thread ID in api.new.get.thread_id - #846
Conversation
|
Hey there and thanks for the PR! I'm kind of conflicted about this PR because on the surface of things - it tries to do good. But in the real world, where people have already deployed workaround code for this like the one below: const newId = gmail.new.get_thread_id();
if (newId) {
newIdCodePath(newId);
} else {
const oldId = gmail.old.get_thread_id();
oldIdCodePath(oldId);
}In these cases, this will be a breaking change. const newId = gmail.new.get_thread_id();
if (newId) {
// BREAKING!!! newId is really oldId, but code tailored for newId will be triggered
newIdCodePath(newId);
} else {
// never run!
const oldId = gmail.old.get_thread_id();
oldIdCodePath(oldId);
}For a change like this to work, the corresponding getters around the code-base accepting thread-IDs will need to also be able to detect if it gets an old-style and new-style ID. And this PR doesn't introduce that code which would be required to support such a change. I propose as a non-breaking alternative something like the below: // gmail.all.* APIs return any kind of ID it can, always
const email_id = await gmail.all.get_email_id();
// gmail.all.* APIs accept any kind of ID it can, always
const email_data = await gmail.all.get_email_data(email_id);
// etcEssentially a new "safe to use" API for everyone. Instead of making breaking changes to an existing one. So I'm not going to accept this PR, but it's not because I don't see the problem you're reporting. It's just that I don't want to replace 1 problem (known) with a potentially new problem (unknown) to people just upgrading gmail.js to the latest version, because dependabot told them to. I'm open to non-breaking solutions to this problem though. Let me know what you think. |
What
Fix issue #814 where new.get.thread_id does not return thread id after Google Workspace change by adding a fallback to legacyThreadId when threadPermId is undefined or the string 'undefined'.
Why
This change resolves the target issue or improvement.
How to test
Verify that the project builds/runs correctly and the specific bug/improvement is addressed.
Fixes #814