aboutsummaryrefslogtreecommitdiff
path: root/src/modules/statuses.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/statuses.js')
-rw-r--r--src/modules/statuses.js25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index a16342e0..8e0203e3 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -123,7 +123,7 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
const maxNew = statuses.length > 0 ? maxBy(statuses, 'id').id : 0
const minNew = statuses.length > 0 ? minBy(statuses, 'id').id : 0
- const newer = timeline && maxNew > timelineObject.maxId && statuses.length > 0
+ const newer = timeline && (maxNew > timelineObject.maxId || timelineObject.maxId === 0) && statuses.length > 0
const older = timeline && (minNew < timelineObject.minId || timelineObject.minId === 0) && statuses.length > 0
if (!noIdUpdate && newer) {
@@ -363,6 +363,15 @@ export const mutations = {
},
setRetweeted (state, { status, value }) {
const newStatus = state.allStatusesObject[status.id]
+
+ if (newStatus.repeated !== value) {
+ if (value) {
+ newStatus.repeat_num++
+ } else {
+ newStatus.repeat_num--
+ }
+ }
+
newStatus.repeated = value
},
setDeleted (state, { status }) {
@@ -433,13 +442,6 @@ const statuses = {
// Optimistic favoriting...
commit('setFavorited', { status, value: true })
apiService.favorite({ id: status.id, credentials: rootState.users.currentUser.credentials })
- .then(response => {
- if (response.ok) {
- return response.json()
- } else {
- return {}
- }
- })
.then(status => {
commit('setFavoritedConfirm', { status })
})
@@ -448,13 +450,6 @@ const statuses = {
// Optimistic favoriting...
commit('setFavorited', { status, value: false })
apiService.unfavorite({ id: status.id, credentials: rootState.users.currentUser.credentials })
- .then(response => {
- if (response.ok) {
- return response.json()
- } else {
- return {}
- }
- })
.then(status => {
commit('setFavoritedConfirm', { status })
})