Skip to content

Commit

Permalink
Improve doc-owner link params (#628)
Browse files Browse the repository at this point in the history
* Fix non-top-100 owner filtering

* Update toolbar.ts

* Add default query to TileMedium

* Improve doc-owner linkTo

* Fix broken tests, improve "Clear all" function
  • Loading branch information
jeffdaley authored Mar 5, 2024
1 parent aeb4e9e commit 4982260
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/app/components/doc/tile-medium.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
data-test-document-owner-avatar
tabindex="-1"
@route="authenticated.documents"
@query={{hash owners=(array owner)}}
@query={{this.ownerQuery}}
disabled={{not owner}}
>
<Person::Avatar
Expand Down Expand Up @@ -65,7 +65,7 @@
tabindex="-1"
data-test-document-owner-name
@route="authenticated.documents"
@query={{hash owners=(array owner)}}
@query={{this.ownerQuery}}
disabled={{not owner}}
class="underline-on-hover inline-block"
>
Expand Down
13 changes: 13 additions & 0 deletions web/app/components/doc/tile-medium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { HermesDocument } from "hermes/types/document";
import { inject as service } from "@ember/service";
import FetchService from "hermes/services/fetch";
import ConfigService from "hermes/services/config";
import { DEFAULT_FILTERS } from "hermes/services/active-filters";

interface DocTileMediumComponentSignature {
Element: HTMLAnchorElement;
Expand Down Expand Up @@ -63,6 +64,18 @@ export default class DocTileMediumComponent extends Component<DocTileMediumCompo
return this.args.doc._snippetResult?.content.value;
}
}
/**
* The query parameters for the doc-owner LinkTos.
* Sets the "owners" filter to the owner of the document,
* and default values for the rest.
*/
protected get ownerQuery() {
return {
...DEFAULT_FILTERS,
owners: this.args.doc.owners,
page: 1,
};
}
}

declare module "@glint/environment-ember-loose/registry" {
Expand Down

0 comments on commit 4982260

Please sign in to comment.