Skip to content

Commit

Permalink
Hide useless actions in the toolbar/context menu when all of selected…
Browse files Browse the repository at this point in the history
… content items are Pending Delete (#4567)

(cherry picked from commit eb7ec69)
  • Loading branch information
alansemenov committed Mar 14, 2017
1 parent c2ce97d commit a809831
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class PreviewContentHandler {
return;
}

if (this.isBlocked()) {
if (this.isBlocked() || !changes) {
this.setRenderableIds([]);
if (changes) {
changes.setAdded(contentBrowseItems);
Expand Down Expand Up @@ -127,7 +127,7 @@ export class PreviewContentHandler {
return this.renderableIds;
}

addRenderableIds(contentIds: ContentId[], silent ?: boolean) {
private addRenderableIds(contentIds: ContentId[], silent ?: boolean) {
if (contentIds) {
contentIds.forEach((contentId) => {
if (this.renderableIds.indexOf(contentId.toString()) === -1) {
Expand All @@ -140,15 +140,17 @@ export class PreviewContentHandler {
}
}

removeRenderableIds(contentIds: ContentId[], silent ?: boolean) {
private removeRenderableIds(contentIds: ContentId[], silent ?: boolean) {
let wasRemoved = false;
if (contentIds) {
contentIds.forEach((contentId) => {
let index = this.renderableIds.indexOf(contentId.toString());
if (index >= 0) {
wasRemoved = true;
this.renderableIds.splice(index, 1);
}
});
if (!silent) {
if (!silent || wasRemoved) {
this.notifyPreviewStateChangedIfNeeded();
}
}
Expand Down

0 comments on commit a809831

Please sign in to comment.