aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/conversation-page/conversation-page.js4
-rw-r--r--src/components/conversation/conversation.js16
-rw-r--r--src/components/status/status.js5
-rw-r--r--src/components/tab_switcher/tab_switcher.jsx28
-rw-r--r--src/components/user_profile/user_profile.js16
-rw-r--r--src/components/user_profile/user_profile.vue1
6 files changed, 50 insertions, 20 deletions
diff --git a/src/components/conversation-page/conversation-page.js b/src/components/conversation-page/conversation-page.js
index beffa5bb..8f1ac3d9 100644
--- a/src/components/conversation-page/conversation-page.js
+++ b/src/components/conversation-page/conversation-page.js
@@ -1,5 +1,5 @@
import Conversation from '../conversation/conversation.vue'
-import { find, toInteger } from 'lodash'
+import { find } from 'lodash'
const conversationPage = {
components: {
@@ -7,7 +7,7 @@ const conversationPage = {
},
computed: {
statusoid () {
- const id = toInteger(this.$route.params.id)
+ const id = this.$route.params.id
const statuses = this.$store.state.statuses.allStatuses
const status = find(statuses, {id})
diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js
index 9d9f7bbe..9bf5e136 100644
--- a/src/components/conversation/conversation.js
+++ b/src/components/conversation/conversation.js
@@ -1,9 +1,8 @@
import { reduce, filter, sortBy } from 'lodash'
-import { statusType } from '../../modules/statuses.js'
import Status from '../status/status.vue'
const sortAndFilterConversation = (conversation) => {
- conversation = filter(conversation, (status) => statusType(status) !== 'retweet')
+ conversation = filter(conversation, (status) => status.type !== 'retweet')
return sortBy(conversation, 'id')
}
@@ -18,10 +17,12 @@ const conversation = {
'collapsable'
],
computed: {
- status () { return this.statusoid },
+ status () {
+ return this.statusoid
+ },
conversation () {
if (!this.status) {
- return false
+ return []
}
const conversationId = this.status.statusnet_conversation_id
@@ -32,7 +33,9 @@ const conversation = {
replies () {
let i = 1
return reduce(this.conversation, (result, {id, in_reply_to_status_id}) => {
- const irid = Number(in_reply_to_status_id)
+ /* eslint-disable camelcase */
+ const irid = in_reply_to_status_id
+ /* eslint-enable camelcase */
if (irid) {
result[irid] = result[irid] || []
result[irid].push({
@@ -69,7 +72,6 @@ const conversation = {
}
},
getReplies (id) {
- id = Number(id)
return this.replies[id] || []
},
focused (id) {
@@ -80,7 +82,7 @@ const conversation = {
}
},
setHighlight (id) {
- this.highlight = Number(id)
+ this.highlight = id
}
}
}
diff --git a/src/components/status/status.js b/src/components/status/status.js
index 7d6acbac..105a736b 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -129,7 +129,7 @@ const Status = {
if (this.status.user.id === this.$store.state.users.currentUser.id) {
return false
}
- if (this.status.activity_type === 'repeat') {
+ if (this.status.type === 'retweet') {
return false
}
var checkFollowing = this.$store.state.config.replyVisibility === 'following'
@@ -258,7 +258,7 @@ const Status = {
},
replyEnter (id, event) {
this.showPreview = true
- const targetId = Number(id)
+ const targetId = id
const statuses = this.$store.state.statuses.allStatuses
if (!this.preview) {
@@ -283,7 +283,6 @@ const Status = {
},
watch: {
'highlight': function (id) {
- id = Number(id)
if (this.status.id === id) {
let rect = this.$el.getBoundingClientRect()
if (rect.top < 100) {
diff --git a/src/components/tab_switcher/tab_switcher.jsx b/src/components/tab_switcher/tab_switcher.jsx
index 2f362c4d..9038733c 100644
--- a/src/components/tab_switcher/tab_switcher.jsx
+++ b/src/components/tab_switcher/tab_switcher.jsx
@@ -6,18 +6,26 @@ export default Vue.component('tab-switcher', {
name: 'TabSwitcher',
data () {
return {
- active: 0
+ active: this.$slots.default.findIndex(_ => _.tag)
}
},
methods: {
- activateTab(index) {
- return () => this.active = index;
+ activateTab (index) {
+ return () => {
+ this.active = index
+ }
}
},
- render(h) {
+ beforeUpdate () {
+ const currentSlot = this.$slots.default[this.active]
+ if (!currentSlot.tag) {
+ this.active = this.$slots.default.findIndex(_ => _.tag)
+ }
+ },
+ render (h) {
const tabs = this.$slots.default
- .filter(slot => slot.data)
.map((slot, index) => {
+ if (!slot.tag) return
const classesTab = ['tab']
const classesWrapper = ['tab-wrapper']
@@ -25,20 +33,24 @@ export default Vue.component('tab-switcher', {
classesTab.push('active')
classesWrapper.push('active')
}
+
return (
<div class={ classesWrapper.join(' ')}>
<button onClick={this.activateTab(index)} class={ classesTab.join(' ') }>{slot.data.attrs.label}</button>
</div>
)
- });
- const contents = this.$slots.default.filter(_=>_.data).map(( slot, index ) => {
+ })
+
+ const contents = this.$slots.default.map((slot, index) => {
+ if (!slot.tag) return
const active = index === this.active
return (
<div class={active ? 'active' : 'hidden'}>
{slot}
</div>
)
- });
+ })
+
return (
<div class="tab-switcher">
<div class="tabs">
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js
index bde20707..c9197a1c 100644
--- a/src/components/user_profile/user_profile.js
+++ b/src/components/user_profile/user_profile.js
@@ -5,24 +5,33 @@ import Timeline from '../timeline/timeline.vue'
const UserProfile = {
created () {
this.$store.commit('clearTimeline', { timeline: 'user' })
+ this.$store.commit('clearTimeline', { timeline: 'favorites' })
this.$store.dispatch('startFetching', ['user', this.fetchBy])
+ this.$store.dispatch('startFetching', ['favorites', this.fetchBy])
if (!this.user.id) {
this.$store.dispatch('fetchUser', this.fetchBy)
}
},
destroyed () {
this.$store.dispatch('stopFetching', 'user')
+ this.$store.dispatch('stopFetching', 'favorites')
},
computed: {
timeline () {
return this.$store.state.statuses.timelines.user
},
+ favorites () {
+ return this.$store.state.statuses.timelines.favorites
+ },
userId () {
return this.$route.params.id || this.user.id
},
userName () {
return this.$route.params.name || this.user.screen_name
},
+ isUs () {
+ return this.userId === this.$store.state.users.currentUser.id
+ },
friends () {
return this.user.friends
},
@@ -62,21 +71,28 @@ const UserProfile = {
}
},
watch: {
+ // TODO get rid of this copypasta
userName () {
if (this.isExternal) {
return
}
this.$store.dispatch('stopFetching', 'user')
+ this.$store.dispatch('stopFetching', 'favorites')
this.$store.commit('clearTimeline', { timeline: 'user' })
+ this.$store.commit('clearTimeline', { timeline: 'favorites' })
this.$store.dispatch('startFetching', ['user', this.fetchBy])
+ this.$store.dispatch('startFetching', ['favorites', this.fetchBy])
},
userId () {
if (!this.isExternal) {
return
}
this.$store.dispatch('stopFetching', 'user')
+ this.$store.dispatch('stopFetching', 'favorites')
this.$store.commit('clearTimeline', { timeline: 'user' })
+ this.$store.commit('clearTimeline', { timeline: 'favorites' })
this.$store.dispatch('startFetching', ['user', this.fetchBy])
+ this.$store.dispatch('startFetching', ['favorites', this.fetchBy])
},
user () {
if (this.user.id && !this.user.followers) {
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index 50619026..d64ce277 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -20,6 +20,7 @@
<i class="icon-spin3 animate-spin"></i>
</div>
</div>
+ <Timeline v-if="isUs" :label="$t('user_card.favorites')" :embedded="true" :title="$t('user_profile.favorites_title')" timeline-name="favorites" :timeline="favorites"/>
</tab-switcher>
</div>
<div v-else class="panel user-profile-placeholder">