Skip to content

Commit 7e29efa

Browse files
committed
feat(comments): add deep link API route and release notes
1 parent c918365 commit 7e29efa

File tree

3 files changed

+85
-2
lines changed

3 files changed

+85
-2
lines changed

docs/reference/rest_api_requests.md

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,8 @@ Content-Type: application/json
601601
"created_by": {"user": "1"},
602602
"id": "{comment_id}",
603603
"links": {
604-
"self": "{scheme+hostname}/api/requests/{rquest_id}/comments/{comment_id}"
604+
"self": "{scheme+hostname}/api/requests/{request_id}/comments/{comment_id}"
605+
"self_html": "{scheme+hostname}/me/requests/{request_id}#commentevent-{comment_id}"
605606
},
606607
"payload": {
607608
"content": "I would use these subject terms to align this record and the other one with others in the community.",
@@ -615,6 +616,8 @@ Content-Type: application/json
615616
],
616617
"total": 2
617618
},
619+
"sortBy": "oldest",
620+
"page": 1,
618621
"links": {
619622
"self": "{scheme+hostname}/api/requests/{request_id}/timeline?page=1&size=25&sort=oldest"
620623
}
@@ -624,3 +627,68 @@ Content-Type: application/json
624627
!!! info "Advanced timeline search"
625628

626629
The timeline endpoint can be searched, sorted, filtered, paginated etc., like any other InvenioRDM search endpoint.
630+
631+
### Get the timeline focused on a specific event
632+
633+
`GET /api/requests/{request_id}/timeline_focused?focus_event_id={event_id}`
634+
635+
Same as above, except the page containing the specified event is returned.
636+
If the event is not found or does not belong to the request, the first page of events is instead returned.
637+
The page number used is returned as the `"page"` key of the response.
638+
639+
The `"self_html"` link of the returned items is a pagination-aware deep link that causes the event to be scrolled to and highlighted
640+
when the request page is opened (only if the event is of type `CommentEventType`).
641+
642+
The events are always sorted oldest-to-newest.
643+
644+
**Parameters**
645+
646+
| Name | Type | Location | Description |
647+
| ----------------------- | ------ | -------- | ------------------------------------------------------------------------------------ |
648+
| `request_id`   | string | path | The request's public identifier. |
649+
| `focus_event_id`   | string | query | The events's public identifier. |
650+
| `size` | integer | query | Specify number of items in the results page (default: 10). |
651+
| `accept` | string | header | - `application/json` (default)<br />- `application/vnd.inveniordm.v1+json` (not yet) |
652+
653+
**Request**
654+
655+
```http
656+
GET /api/requests/{request_id}/timeline_focused?focus_event_id={event_id} HTTP/1.1
657+
```
658+
659+
**Response**
660+
661+
```http
662+
HTTP/1.1 200 OK
663+
Content-Type: application/json
664+
665+
{
666+
"hits": {
667+
"hits": [
668+
{
669+
"created": "2020-11-27 10:52:23.945755",
670+
"created_by": {"user": "1"},
671+
"id": "{comment_id}",
672+
"links": {
673+
"self": "{scheme+hostname}/api/requests/{request_id}/comments/{comment_id}"
674+
"self_html": "{scheme+hostname}/me/requests/{request_id}#commentevent-{comment_id}"
675+
},
676+
"payload": {
677+
"content": "I would use these subject terms to align this record and the other one with others in the community.",
678+
"format": "html"
679+
},
680+
"revision_id": 2,
681+
"type": "C",
682+
"updated": "2020-11-27 10:55:23.969244",
683+
},
684+
...
685+
],
686+
"total": 2
687+
},
688+
"sortBy": "oldest",
689+
"page": 1,
690+
"links": {
691+
"self": "{scheme+hostname}/api/requests/{request_id}/timeline?page=1&size=25&sort=oldest"
692+
}
693+
}
694+
```
15 KB
Loading

docs/releases/vNext/version-vNext.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,22 @@ You can now allow users to delete, or request deletion of, their own records in
2525

2626
This feature is also [highly customisable](../../operate/customize/record_deletion.md)! You can introduce deletion policies based on the resource type, community role, file type or any other criteria you require. Additionally, you can prevent extraneous record deletion by adding a deletion checklist. This allows you to suggest how the user can fix the problem in the correct way instead of deleting the record.
2727

28-
#### New Web Archive previewer
28+
### Request commenting enhancements
29+
30+
We've introduced a number of exciting new features to improve the commenting experience on requests, which are currently used across InvenioRDM
31+
for a range of purposes such as community record submission.
32+
33+
#### Deep links
34+
35+
You can now copy a link to a comment directly, allowing for easy and precise sharing.
36+
When opened, the link will take the user to the comment and highlight it, regardless of which page it's on.
37+
38+
To use deep links, simply click the "Copy link" button on a comment:
39+
40+
![Comment with the "copy link" button](imgs/comment-deep-link.png)
41+
42+
43+
### New Web Archive previewer
2944

3045
https://github.com/inveniosoftware/invenio-previewer/pull/224
3146

0 commit comments

Comments
 (0)