mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
Merge pull request #1925 from ether/move-padlist-init
Move padlist init
This commit is contained in:
commit
d86d99bc16
1 changed files with 11 additions and 1 deletions
|
@ -37,6 +37,11 @@ var globalPads = {
|
||||||
set: function (name, value)
|
set: function (name, value)
|
||||||
{
|
{
|
||||||
this[':'+name] = value;
|
this[':'+name] = value;
|
||||||
|
|
||||||
|
if(!padList.list.length == 0){ // If we haven't populated the padList.list yet
|
||||||
|
padList.init();
|
||||||
|
}
|
||||||
|
|
||||||
padList.addPad(name);
|
padList.addPad(name);
|
||||||
},
|
},
|
||||||
remove: function (name) { delete this[':'+name]; }
|
remove: function (name) { delete this[':'+name]; }
|
||||||
|
@ -85,7 +90,6 @@ var padList = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//initialises the allknowing data structure
|
//initialises the allknowing data structure
|
||||||
padList.init();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of padId transformations. These represent changes in pad name policy over
|
* An array of padId transformations. These represent changes in pad name policy over
|
||||||
|
@ -159,6 +163,9 @@ exports.getPad = function(id, text, callback)
|
||||||
|
|
||||||
exports.listAllPads = function(callback)
|
exports.listAllPads = function(callback)
|
||||||
{
|
{
|
||||||
|
if(!padList.list.length == 0){ // If we haven't populated the padList.list yet
|
||||||
|
padList.init();
|
||||||
|
}
|
||||||
if(callback != null){
|
if(callback != null){
|
||||||
callback(null,{padIDs: padList.getPads()});
|
callback(null,{padIDs: padList.getPads()});
|
||||||
}else{
|
}else{
|
||||||
|
@ -224,6 +231,9 @@ exports.isValidPadId = function(padId)
|
||||||
* Removes the pad from database and unloads it.
|
* Removes the pad from database and unloads it.
|
||||||
*/
|
*/
|
||||||
exports.removePad = function(padId){
|
exports.removePad = function(padId){
|
||||||
|
if(!padList.list.length == 0){ // If we haven't populated the padList.list yet
|
||||||
|
padList.init();
|
||||||
|
}
|
||||||
db.remove("pad:"+padId);
|
db.remove("pad:"+padId);
|
||||||
exports.unloadPad(padId);
|
exports.unloadPad(padId);
|
||||||
padList.removePad(padId);
|
padList.removePad(padId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue