Skip to content

Commit

Permalink
[Discover] apply suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaanj committed Mar 15, 2022
1 parent 17927ed commit d1a345a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/plugins/discover/public/utils/get_sharing_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ export async function getSharingData(
const relativeTimeFilter = data.query.timefilter.timefilter.createRelativeFilter(index);
return {
getSearchSource: (absoluteTime?: boolean): SerializedSearchSourceFields => {
const absoluteFilter = data.query.timefilter.timefilter.createFilter(index);
const timeFilter = absoluteTime ? absoluteTimeFilter : relativeTimeFilter;

// remove timeFilter from existing filter
if (Array.isArray(existingFilter)) {
existingFilter = existingFilter.filter(
(current) => !isEqualFilters(current, absoluteFilter)
(current) => !isEqualFilters(current, absoluteTimeFilter)
);
} else if (isEqualFilters(existingFilter, absoluteFilter)) {
} else if (isEqualFilters(existingFilter, absoluteTimeFilter)) {
existingFilter = undefined;
}

Expand Down

0 comments on commit d1a345a

Please sign in to comment.