2018-03-21 00:41:39 +00:00
|
|
|
function getStatusModifications (store, instanceName) {
|
2018-04-19 16:37:05 +00:00
|
|
|
let { statusModifications } = store.get()
|
2018-03-21 00:41:39 +00:00
|
|
|
statusModifications[instanceName] = statusModifications[instanceName] || {
|
|
|
|
favorites: {},
|
2018-08-30 01:10:09 +00:00
|
|
|
reblogs: {},
|
|
|
|
pins: {}
|
2018-03-21 00:41:39 +00:00
|
|
|
}
|
|
|
|
return statusModifications
|
|
|
|
}
|
|
|
|
|
2018-08-30 01:10:09 +00:00
|
|
|
function setStatusModification (store, instanceName, statusId, key, value) {
|
|
|
|
let statusModifications = getStatusModifications(store, instanceName)
|
|
|
|
statusModifications[instanceName][key][statusId] = value
|
|
|
|
store.set({ statusModifications })
|
|
|
|
}
|
|
|
|
|
2018-03-21 00:41:39 +00:00
|
|
|
export function statusMixins (Store) {
|
|
|
|
Store.prototype.setStatusFavorited = function (instanceName, statusId, favorited) {
|
2018-08-30 01:10:09 +00:00
|
|
|
setStatusModification(this, instanceName, statusId, 'favorites', favorited)
|
2018-03-21 00:41:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Store.prototype.setStatusReblogged = function (instanceName, statusId, reblogged) {
|
2018-08-30 01:10:09 +00:00
|
|
|
setStatusModification(this, instanceName, statusId, 'reblogs', reblogged)
|
|
|
|
}
|
|
|
|
|
|
|
|
Store.prototype.setStatusPinned = function (instanceName, statusId, pinned) {
|
|
|
|
setStatusModification(this, instanceName, statusId, 'pins', pinned)
|
2018-03-21 00:41:39 +00:00
|
|
|
}
|
|
|
|
}
|