1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

vue ui: fixed model "contains" in situation when checking if it contains a snapshot

This commit is contained in:
Ivan Velev 2021-09-28 01:09:41 -07:00
parent fa317deeb4
commit eae6a2e3d1
2 changed files with 13 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -331,10 +331,14 @@ PywbPeriod.prototype.contains = function(periodOrSnapshot) {
return true; // all-time contains everything
}
if (periodOrSnapshot instanceof PywbPeriod) {
return periodOrSnapshot.getParents(true).slice(0,this.type).join(PywbPeriodIdDelimiter) === this.fullId;
return periodOrSnapshot.getParents(true).slice(0,this.type).map(p => p.id).join(PywbPeriodIdDelimiter) === this.fullId;
}
if (periodOrSnapshot instanceof PywbSnapshot) {
return periodOrSnapshot.getParentIds(true).slice(0,this.type).join(PywbPeriodIdDelimiter) === this.fullId;
if (this.type === PywbPeriod.Type.snapshot) {
return periodOrSnapshot.getFullId() === this.fullId;
} else {
return periodOrSnapshot.getParentIds(true).slice(0,this.type).join(PywbPeriodIdDelimiter) === this.fullId;
}
}
return false;
};