Issue 2551258
Created on 2023-02-12 19:33 by rouilj, last changed 2023-02-13 08:55 by schlatterbeck.
Messages | |||
---|---|---|---|
msg7713 | Author: [hidden] (rouilj) | Date: 2023-02-12 19:33 | |
When using the rest interface, there is no place to get the history for the item. It seems like treating it as a collection endpoint makes sense. So i's a read-only endpoint accessible via GET. A url like: rest/data/issue/23/@history?startdate=20131008022843&enddate=20200102131415&limit=10&sort=- date&user=rouilj to get a list of all history for issue23 between 2013-10-08T02:28:43 and 2020-01-02T13:14:15 limited to 10 items sorted by date descending (most recent first) done by the user rouilj. Output would look like: [ { date: '20131008021438.906', // maybe this should be a number?? user: 'rouilj', action: 'set', changes: [ { field: 'priority', oldval: '1'}, { field: 'queue', oldval: '3'}, { field: 'title', oldval: 'my former title'} ] }, { more dates/users/actions } ] Oldval can be null if there was no old value set. But the object properties in the changes array only works for single value fields (string, number, link). For multilinks, rather than recording the old value, we have a change/delta report: { ... action: set changes: [ {field: 'keyword', delta: {add: ['3'], remove: ['8']}} ], } because the payload of the change looks like: (('+', ['3']), ('-', ['8'])). So to get the state of the keyword field before this change, take the current state and remove 3 and add 8. Also multilinks support link unlink actions. { ... action: 'link', // or unlink changes: [ {field: 'group', id: '2', class: 'issue'} } to indicate that issue 2 was linked into the group field. Yeah this is complex to generate and consume. We may need a label or type field to indicate what shape the change data is in. Technically link/unlink can be seen as a set operation with an 'add' if something was linked and a 'remove' if something is unlinked. However representing a link/unlink as a set would differ from how it's presented in the html interface. Also there may be some value in knowing how the change was done. Also there is a create operation which can be represented by: { date: '20131008021438.906', // maybe this should be a number?? user: 'rouilj', action: 'create', }, I think retire and unretire actions can also be present. |
|||
msg7714 | Author: [hidden] (joseph_myers) | Date: 2023-02-12 22:22 | |
You need to consider permissions here. Ability to see the current version of some properties of an item shouldn't necessarily mean ability to see history of those properties; at present this can effectively be controlled by making it conditional in the page templates when history is displayed, but with REST support for history you might need proper permissions support for accessing history. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-02-13 08:55:07 | schlatterbeck | set | nosy: + schlatterbeck |
2023-02-12 22:22:10 | joseph_myers | set | nosy:
+ joseph_myers messages: + msg7714 |
2023-02-12 19:33:46 | rouilj | set | keywords: + Effort-Medium |
2023-02-12 19:33:32 | rouilj | create |