Bug 496273: Cannot unsubscribe newsgroup (Error: server is undefined). r=standard8

This commit is contained in:
Magnus Melin 2009-06-30 17:28:28 +03:00
Родитель 28dbd5a93d
Коммит f1d1267fae
3 изменённых файлов: 15 добавлений и 18 удалений

Просмотреть файл

@ -1547,8 +1547,8 @@ let gFolderTreeController = {
let folder = folders[0];
// For newsgroups, "delete" means "unsubscribe".
if (folder.server.type == "nntp" && ConfirmUnsubscribe(folders)) {
Unsubscribe(folders);
if (folder.server.type == "nntp") {
MsgUnsubscribe(folders);
return;
}

Просмотреть файл

@ -310,17 +310,6 @@ function NewFolder(name, folder)
folder.createSubfolder(name, msgWindow);
}
function UnSubscribe(folder)
{
// Unsubscribe the current folder from the newsserver, this assumes any confirmation has already
// been made by the user SPL
var server = folder.server;
var subscribableServer = server.QueryInterface(Components.interfaces.nsISubscribableServer);
subscribableServer.unsubscribe(folder.name);
subscribableServer.commitSubscribeChanges();
}
function Subscribe(preselectedMsgFolder)
{
window.openDialog("chrome://messenger/content/subscribe.xul",

Просмотреть файл

@ -1597,13 +1597,21 @@ function ConfirmUnsubscribe(folders)
}
/**
* Unsubscribe from selected newsgroup/s.
* Unsubscribe from selected or passed in newsgroup/s.
* @param newsgroups (optional param) the newsgroup folders to unsubscribe from
*/
function MsgUnsubscribe()
function MsgUnsubscribe(newsgroups)
{
var folders = gFolderTreeView.getSelectedFolders();
if (ConfirmUnsubscribe(folders))
UnSubscribe(folders);
var folders = newsgroups || gFolderTreeView.getSelectedFolders();
if (!ConfirmUnsubscribe(folders))
return;
for (let i = 0; i < folders.length; i++) {
let subscribableServer = folders[i].server.QueryInterface(
Components.interfaces.nsISubscribableServer);
subscribableServer.unsubscribe(folders[i].name);
subscribableServer.commitSubscribeChanges();
}
}
function ToggleFavoriteFolderFlag()