diff options
| author | Henry Jameson <me@hjkos.com> | 2019-03-08 00:35:30 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-03-08 00:35:30 +0200 |
| commit | ee49409049430dedf042ddbeb73898f605664cd2 (patch) | |
| tree | 0d75e17b13d3906a5f97bc4025bf0a6e4a53c649 /src/modules/statuses.js | |
| parent | 09736691ea79e66c9e41d6f723384769088eb2d0 (diff) | |
Partially transitioned user data to MastoAPI. Added support for fetching
relationship data. Upgraded code to be more resilient to nulls caused by missing
data in either APIs
Diffstat (limited to 'src/modules/statuses.js')
| -rw-r--r-- | src/modules/statuses.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 7571b62a..2b0215f0 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -1,4 +1,4 @@ -import { remove, slice, each, find, maxBy, minBy, merge, first, last, isArray } from 'lodash' +import { remove, slice, each, find, maxBy, minBy, merge, first, last, isArray, omitBy } from 'lodash' import apiService from '../services/api/api.service.js' // import parse from '../services/status_parser/status_parser.js' @@ -72,7 +72,9 @@ const mergeOrAdd = (arr, obj, item) => { if (oldItem) { // We already have this, so only merge the new info. - merge(oldItem, item) + // We ignore null values to avoid overwriting existing properties with missing data + // we also skip 'used' because that is handled by users module + merge(oldItem, omitBy(item, (v, k) => v === null || k === 'user')) // Reactivity fix. oldItem.attachments.splice(oldItem.attachments.length) return {item: oldItem, new: false} |
