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: {},
|
|
|
|
reblogs: {}
|
|
|
|
}
|
|
|
|
return statusModifications
|
|
|
|
}
|
|
|
|
|
|
|
|
export function statusMixins (Store) {
|
|
|
|
Store.prototype.setStatusFavorited = function (instanceName, statusId, favorited) {
|
|
|
|
let statusModifications = getStatusModifications(this, instanceName)
|
|
|
|
statusModifications[instanceName].favorites[statusId] = favorited
|
|
|
|
this.set({statusModifications})
|
|
|
|
}
|
|
|
|
|
|
|
|
Store.prototype.setStatusReblogged = function (instanceName, statusId, reblogged) {
|
|
|
|
let statusModifications = getStatusModifications(this, instanceName)
|
|
|
|
statusModifications[instanceName].reblogs[statusId] = reblogged
|
|
|
|
this.set({statusModifications})
|
|
|
|
}
|
|
|
|
}
|