|
1 | | -import View from './../core/view'; |
2 | | -import Model from './../core/model'; |
3 | | -import Node from './../jsonld/node'; |
| 1 | +import View from '../core/view'; |
| 2 | +import Model from '../core/model'; |
| 3 | +import Collection from '../core/collection'; |
| 4 | +import Node from '../jsonld/node'; |
| 5 | +import userChannel from '../user/radio'; |
4 | 6 |
|
5 | 7 | import ExplorerView from './explorer-view'; |
6 | 8 | import LdItemView from '../panel-ld-item/ld-item-view'; |
| 9 | +import ldChannel from '../jsonld/radio'; |
7 | 10 | import Graph from '../jsonld/graph'; |
8 | | -import SourceView from './../panel-source/source-view'; |
| 11 | +import SourceView from '../panel-source/source-view'; |
9 | 12 | import AnnotationListPanel from '../annotation/annotation-list-panel'; |
10 | 13 | import SuggestionsView from '../suggestions/suggestions-view'; |
11 | 14 |
|
@@ -188,8 +191,17 @@ export default class ExplorerEventController { |
188 | 191 |
|
189 | 192 | showAnnotationsOfCategory(view: SuggestionsView, category: Node): SearchResultListView { |
190 | 193 | let items = new ItemGraph(); |
191 | | - items.query({ predicate: oa.hasBody, object: category.id }).catch(console.error); |
192 | | - const flatItems = new FlatItemCollection(items); |
| 194 | + items.query({ |
| 195 | + predicate: oa.hasBody, |
| 196 | + object: category.id, |
| 197 | + }).catch(console.error); |
| 198 | + let flatItems: Collection<FlatItem> = new FlatItemCollection(items); |
| 199 | + if (!userChannel.request('permission', 'view_all_annotations')) { |
| 200 | + const userUri = ldChannel.request('current-user-uri'); |
| 201 | + const userNode = ldChannel.request('obtain', userUri); |
| 202 | + const filter = item => item.get('creator') === userNode; |
| 203 | + flatItems = new FilteredCollection<FlatItem>(flatItems, filter); |
| 204 | + } |
193 | 205 | const resultView = new SearchResultListView({ |
194 | 206 | model: category, |
195 | 207 | collection: flatItems, |
|
0 commit comments