diff options
| author | dave <starpumadev@gmail.com> | 2019-04-07 11:44:45 -0400 |
|---|---|---|
| committer | taehoon <th.dev91@gmail.com> | 2019-05-15 12:04:25 -0400 |
| commit | e6268c492e77f45794af9e8ee8e334e194a6de15 (patch) | |
| tree | 1884f2d9e580276a3b8b16a77998ab3c72e3e7f1 | |
| parent | 5ab0e71500071d3a760f1a67258d10c564b4425e (diff) | |
#468 - clean up
| -rw-r--r-- | src/components/status/status.js | 4 | ||||
| -rw-r--r-- | src/modules/statuses.js | 20 |
2 files changed, 9 insertions, 15 deletions
diff --git a/src/components/status/status.js b/src/components/status/status.js index 39a1b236..85159fc4 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -362,7 +362,9 @@ const Status = { this.$store.state.api.backendInteractor.pinOwnStatus(this.status.id).then((status) => { if (status.error) { this.error = status.error - setTimeout(() => this.error = null, 5000) + setTimeout(() => { + this.error = null + }, 5000) } else { this.$store.dispatch('updatePinned', status) } diff --git a/src/modules/statuses.js b/src/modules/statuses.js index bbc1a45b..b93f9cb5 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -367,24 +367,16 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot const removeStatus = (state, { timeline, userId, statusId }) => { const timelineObject = state.timelines[timeline] - let removed = false - if (userId) { - remove(timelineObject.statuses, { user: { id: userId } }) - remove(timelineObject.visibleStatuses, { user: { id: userId } }) - removed = true - } else if (statusId) { - remove(timelineObject.statuses, { id: statusId }) - remove(timelineObject.visibleStatuses, { id: statusId }) - removed = true + const status = userId ? { user: { id: userId } } : { id: statusId } + remove(timelineObject.statuses, status) + remove(timelineObject.visibleStatuses, status) + if (statusId) { delete timelineObject.statusesObject[statusId] delete timelineObject.visibleStatusesObject[statusId] sortTimeline(timelineObject) } - - if (removed) { - timelineObject.minVisibleId = timelineObject.visibleStatuses.length > 0 ? last(timelineObject.visibleStatuses).id : 0 - timelineObject.maxId = timelineObject.statuses.length > 0 ? first(timelineObject.statuses).id : 0 - } + timelineObject.minVisibleId = timelineObject.visibleStatuses.length > 0 ? last(timelineObject.visibleStatuses).id : 0 + timelineObject.maxId = timelineObject.statuses.length > 0 ? first(timelineObject.statuses).id : 0 } export const mutations = { |
