问题描述
好的,我认为网络 Gmail 有点搞砸了.我运行了一个 Google 应用程序脚本,该脚本将我的待办事项"标签部分添加到我手动加星标的任何线程中,然后将其归档并取消星标.下面是一个片段.我会很感激任何帮助.
OK, I think web Gmail is being screwy. I run a Google apps script that in part adds my "To-do" label to any thread I manually star, then archives and unstars it. A snippet is below. I'd appreciate any help.
运行脚本后,线程会获得标签并取消星标,但网络 Gmail 中线程/消息旁边的星形图标仍显示为选中状态.如果我转到已加星标的消息标签/文件夹,则不会显示任何内容.如果我立即重新运行脚本,它不会找到任何已加星标的线程.这似乎表明脚本工作正常.问题似乎是网络 Gmail 仍然希望将其显示为已加星标,即使它不是.Gmail Android 应用程序不显示应用于线程的星号.图片更值钱……
After running the script the thread gets the label and is unstarred, except the star icon next to the thread/message in web Gmail still shows as selected. If I go to Starred messages label/folder nothing is displayed. If I immediately rerun the script it doesn't find any Starred threads. This seems to indicate the script is working OK. The problem seems to be that web Gmail still wants to show it as Starred even though it isn't. Gmail Android app doesn't show the star applied to the thread. Pictures are worth more...
脚本运行后我的收件箱是什么样的.注意星号:
What my inbox looks like after the script runs. Note the star:
还没有加星标的消息:
function addStarred2ToDo() {
var threads = GmailApp.search('is:starred');
for (var h in threads) {
var messages = threads[h].getMessages();
for (var i in messages) {
if (messages[i].isStarred()) {
messages[i].unstar();
}
}
}
}
我也试过这个,但都没有产生预期的结果.
I also tried this and neither produce what is expected.
function thisOne() {
var threads = GmailApp.search('is:starred');
for (var h in threads) {
var messages = threads[h].getMessages();
for (var i in messages) {
if (messages[i].isStarred()) {
messages[i].unstar().refresh();
}
}
}
}
function andThisOne() {
var threads = GmailApp.search('is:starred');
var toUnstar = [];
threads.forEach(function (thread) {
thread.getMessages().forEach(function (message) {
if (message.isStarred()) {
toUnstar.push(message);
}
});
});
GmailApp.unstarMessages(toUnstar);
}
推荐答案
如果您刷新 gmail 并将鼠标悬停在星标上,您会看到弹出窗口显示它未注视.此外,当您从 gmail 中选择星标时,这似乎是一个问题,因为当我的脚本取消星标时,我的过滤器设置的星标可以正常工作.
If you refresh gmail and hover over the star, you will see that the popup says it is Not Stared. Also, this seems to be an issue when you select the star from gmail, as stars that are set by my filters work correctly when my script unstars them.
这篇关于即使在 Apps 脚本取消星标后,Web Gmail 仍将邮件显示为已加星标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!