Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

closes #264 Fix change status in home and notifications #265

Merged
merged 1 commit into from
Apr 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="mention">
<toot :message="message.status"></toot>
<toot :message="message.status" v-on:update="updateToot"></toot>
</div>
</template>

Expand All @@ -10,6 +10,11 @@ import Toot from '../Toot'
export default {
name: 'mention',
props: ['message'],
components: { Toot }
components: { Toot },
methods: {
updateToot (message) {
this.$store.commit('TimelineSpace/Contents/Notifications/updateToot', message)
}
}
}
</script>
5 changes: 4 additions & 1 deletion src/renderer/components/TimelineSpace/Contents/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div id="home">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div class="home-timeline" v-for="(message, index) in timeline" v-bind:key="index">
<toot :message="message" :key="message.id"></toot>
<toot :message="message" :key="message.id" v-on:update="updateToot"></toot>
</div>
<div class="loading-card" v-loading="lazyLoading" :element-loading-background="backgroundColor">
</div>
Expand Down Expand Up @@ -62,6 +62,9 @@ export default {
this.$store.commit('TimelineSpace/Contents/Home/changeHeading', true)
this.$store.commit('TimelineSpace/Contents/Home/mergeTimeline')
}
},
updateToot (message) {
this.$store.commit('TimelineSpace/Contents/Home/updateToot', message)
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/renderer/store/TimelineSpace/Contents/Cards/Toot.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const Toot = {
// API returns new status when reblog.
// Reblog target status is in the data.reblog.
// So I send data.reblog as status for update local timeline.
commit('TimelineSpace/updateToot', data.reblog, { root: true })
ipcRenderer.send('fav-rt-action-sound')
resolve(data.reblog)
})
Expand All @@ -35,7 +34,6 @@ const Toot = {
)
client.post(`/statuses/${message.id}/unreblog`, {}, (err, data, res) => {
if (err) return reject(err)
commit('TimelineSpace/updateToot', data, { root: true })
resolve(data)
})
})
Expand All @@ -50,7 +48,6 @@ const Toot = {
)
client.post(`/statuses/${message.id}/favourite`, {}, (err, data, res) => {
if (err) return reject(err)
commit('TimelineSpace/updateToot', data, { root: true })
ipcRenderer.send('fav-rt-action-sound')
resolve(data)
})
Expand All @@ -66,7 +63,6 @@ const Toot = {
)
client.post(`/statuses/${message.id}/unfavourite`, {}, (err, data, res) => {
if (err) return reject(err)
commit('TimelineSpace/updateToot', data, { root: true })
resolve(data)
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/TimelineSpace/Contents/Notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const Notifications = {
})
client.get('/notifications', { max_id: last.id, limit: 30 }, (err, data, res) => {
if (err) return reject(err)
commit('TimelineSpace/insertNotifications', data, { root: true })
commit('insertNotifications', data)
commit('changeLazyLoading', false)
})
})
Expand Down