mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 15:23:33 +00:00
attachments to models
This commit is contained in:
@@ -45,4 +45,19 @@ var LoginData = function (response, userId) {
|
|||||||
|
|
||||||
this.favorite = response.favorite;
|
this.favorite = response.favorite;
|
||||||
this.revisionDate = response.revisionDate;
|
this.revisionDate = response.revisionDate;
|
||||||
|
|
||||||
|
if (response.attachments) {
|
||||||
|
this.attachments = [];
|
||||||
|
for (var i = 0; i < response.attachments.length; i++) {
|
||||||
|
this.attachments.push(new AttachmentData(response.attachments[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var AttachmentData = function (response) {
|
||||||
|
this.id = response.id;
|
||||||
|
this.url = response.url;
|
||||||
|
this.fileName = response.fileName;
|
||||||
|
this.size = response.size;
|
||||||
|
this.sizeName = response.sizeName;
|
||||||
|
};
|
||||||
@@ -112,6 +112,30 @@ var Login = function (obj, alreadyEncrypted) {
|
|||||||
this.notes = obj.notes ? new CipherString(obj.notes) : null;
|
this.notes = obj.notes ? new CipherString(obj.notes) : null;
|
||||||
this.totp = obj.totp ? new CipherString(obj.totp) : null;
|
this.totp = obj.totp ? new CipherString(obj.totp) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (response.attachments) {
|
||||||
|
this.attachments = [];
|
||||||
|
for (var i = 0; i < response.attachments.length; i++) {
|
||||||
|
this.attachments.push(new Attachment(response.attachments[i], alreadyEncrypted));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.attachments = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var Attachment = function (obj, alreadyEncrypted) {
|
||||||
|
this.id = obj.id ? obj.id : null;
|
||||||
|
this.url = obj.url ? obj.url : null;
|
||||||
|
this.size = obj.size ? obj.size : null;
|
||||||
|
this.sizeName = obj.sizeName ? obj.sizeName : null;
|
||||||
|
|
||||||
|
if (alreadyEncrypted === true) {
|
||||||
|
this.fileName = obj.fileName ? obj.fileName : null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.fileName = obj.fileName ? new CipherString(obj.fileName) : null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var Folder = function (obj, alreadyEncrypted) {
|
var Folder = function (obj, alreadyEncrypted) {
|
||||||
|
|||||||
Reference in New Issue
Block a user