Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix(cart): 2222 no undefined in notifications
Browse files Browse the repository at this point in the history
-Bug was 'Removed undefined' appearing instead of 'Removed
[file_name]' when 1 unauthorized file removed. CartService
doesn't have file_name stored, and can't think of a nice
way to get the file name because CartController only has
1 page of names as well. So bandaid solution,
show '1 file' instead of undefined.

Closes #2222
  • Loading branch information
Christine Yu committed Apr 29, 2016
1 parent 364d1a6 commit ca6efd9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/scripts/cart/cart.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ module ngApp.cart.services {
}

getUnauthorizedFiles(): IFile[] {
return this.files.filter((file)=>{
return this.files.filter( (file) => {
return !this.UserService.userCanDownloadFile(file);
});
}
Expand Down Expand Up @@ -269,7 +269,7 @@ module ngApp.cart.services {

buildAddedMsg(added: Array<Object>, alreadyIn: Array<Object>): string {
var message = this.gettextCatalog.getPlural(added.length,
"<span>Added <strong class='word-break-all'>" + _.get(_.first(added), "file_name") + "</strong> to the cart.",
"<span>Added <strong class='word-break-all'>" + _.get(_.first(added), "file_name", "1 file") + "</strong> to the cart.",
"<span>Added <strong>" + added.length + "</strong> files to the cart.");

if (alreadyIn.length) {
Expand All @@ -286,7 +286,7 @@ module ngApp.cart.services {

buildRemovedMsg(removedFiles: IFile[]): string {
var message = this.gettextCatalog.getPlural(removedFiles.length,
"<span>Removed <strong class='word-break-all'>" + _.get(_.first(removedFiles), "file_name") + "</strong> from the cart.",
"<span>Removed <strong class='word-break-all'>" + _.get(_.first(removedFiles), "file_name", "1 file") + "</strong> from the cart.",
"<span>Removed <strong>" + removedFiles.length + "</strong> files from the cart.");

if (removedFiles.length !== 0) {
Expand All @@ -306,7 +306,7 @@ module ngApp.cart.services {
return { remaining: acc.remaining, removed: acc.removed.concat(fileToRemove)};
}
return { remaining: acc.remaining.concat(f), removed: acc.removed};
} ,{ remaining: [], removed: [] });
} , { remaining: [], removed: [] });
this.lastModifiedFiles = partitioned.removed;
this.notify.closeAll();
this.notify({
Expand Down

0 comments on commit ca6efd9

Please sign in to comment.