forked from AkkomaGang/akkoma-fe
Remove all explicit and implicit conversions of statusId to number, changed
explicit ones so that they convert them to string
This commit is contained in:
parent
1fb9ceb59b
commit
ef2585e32b
5 changed files with 15 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
||||||
import Conversation from '../conversation/conversation.vue'
|
import Conversation from '../conversation/conversation.vue'
|
||||||
import { find, toInteger } from 'lodash'
|
import { find } from 'lodash'
|
||||||
|
|
||||||
const conversationPage = {
|
const conversationPage = {
|
||||||
components: {
|
components: {
|
||||||
|
@ -7,7 +7,7 @@ const conversationPage = {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
statusoid () {
|
statusoid () {
|
||||||
const id = toInteger(this.$route.params.id)
|
const id = String(this.$route.params.id)
|
||||||
const statuses = this.$store.state.statuses.allStatuses
|
const statuses = this.$store.state.statuses.allStatuses
|
||||||
const status = find(statuses, {id})
|
const status = find(statuses, {id})
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ const conversation = {
|
||||||
replies () {
|
replies () {
|
||||||
let i = 1
|
let i = 1
|
||||||
return reduce(this.conversation, (result, {id, in_reply_to_status_id}) => {
|
return reduce(this.conversation, (result, {id, in_reply_to_status_id}) => {
|
||||||
const irid = Number(in_reply_to_status_id)
|
const irid = String(in_reply_to_status_id)
|
||||||
if (irid) {
|
if (irid) {
|
||||||
result[irid] = result[irid] || []
|
result[irid] = result[irid] || []
|
||||||
result[irid].push({
|
result[irid].push({
|
||||||
|
@ -69,7 +69,7 @@ const conversation = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getReplies (id) {
|
getReplies (id) {
|
||||||
id = Number(id)
|
id = String(id)
|
||||||
return this.replies[id] || []
|
return this.replies[id] || []
|
||||||
},
|
},
|
||||||
focused (id) {
|
focused (id) {
|
||||||
|
@ -80,7 +80,7 @@ const conversation = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setHighlight (id) {
|
setHighlight (id) {
|
||||||
this.highlight = Number(id)
|
this.highlight = String(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,7 @@ const Status = {
|
||||||
},
|
},
|
||||||
replyEnter (id, event) {
|
replyEnter (id, event) {
|
||||||
this.showPreview = true
|
this.showPreview = true
|
||||||
const targetId = Number(id)
|
const targetId = String(id)
|
||||||
const statuses = this.$store.state.statuses.allStatuses
|
const statuses = this.$store.state.statuses.allStatuses
|
||||||
|
|
||||||
if (!this.preview) {
|
if (!this.preview) {
|
||||||
|
@ -295,7 +295,7 @@ const Status = {
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'highlight': function (id) {
|
'highlight': function (id) {
|
||||||
id = Number(id)
|
id = String(id)
|
||||||
if (this.status.id === id) {
|
if (this.status.id === id) {
|
||||||
let rect = this.$el.getBoundingClientRect()
|
let rect = this.$el.getBoundingClientRect()
|
||||||
if (rect.top < 100) {
|
if (rect.top < 100) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { includes, remove, slice, sortBy, toInteger, each, find, flatten, maxBy, minBy, merge, last, isArray } from 'lodash'
|
import { includes, remove, slice, each, find, flatten, maxBy, minBy, merge, last, isArray } from 'lodash'
|
||||||
import apiService from '../services/api/api.service.js'
|
import apiService from '../services/api/api.service.js'
|
||||||
// import parse from '../services/status_parser/status_parser.js'
|
// import parse from '../services/status_parser/status_parser.js'
|
||||||
|
|
||||||
|
@ -122,9 +122,11 @@ const mergeOrAdd = (arr, obj, item) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sortById = (a, b) => a.id > b.id ? -1 : 1
|
||||||
|
|
||||||
const sortTimeline = (timeline) => {
|
const sortTimeline = (timeline) => {
|
||||||
timeline.visibleStatuses = sortBy(timeline.visibleStatuses, ({id}) => -id)
|
timeline.visibleStatuses = timeline.visibleStatuses.sort(sortById)
|
||||||
timeline.statuses = sortBy(timeline.statuses, ({id}) => -id)
|
timeline.statuses = timeline.statuses.sort(sortById)
|
||||||
timeline.minVisibleId = (last(timeline.visibleStatuses) || {}).id
|
timeline.minVisibleId = (last(timeline.visibleStatuses) || {}).id
|
||||||
return timeline
|
return timeline
|
||||||
}
|
}
|
||||||
|
@ -200,7 +202,7 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
|
||||||
}
|
}
|
||||||
|
|
||||||
const favoriteStatus = (favorite, counter) => {
|
const favoriteStatus = (favorite, counter) => {
|
||||||
const status = find(allStatuses, { id: toInteger(favorite.in_reply_to_status_id) })
|
const status = find(allStatuses, { id: String(favorite.in_reply_to_status_id) })
|
||||||
if (status) {
|
if (status) {
|
||||||
// This is our favorite, so the relevant bit.
|
// This is our favorite, so the relevant bit.
|
||||||
if (favorite.user.id === user.id) {
|
if (favorite.user.id === user.id) {
|
||||||
|
|
|
@ -10,8 +10,8 @@ export const visibleTypes = store => ([
|
||||||
].filter(_ => _))
|
].filter(_ => _))
|
||||||
|
|
||||||
export const visibleNotificationsFromStore = store => {
|
export const visibleNotificationsFromStore = store => {
|
||||||
// Don't know why, but sortBy([seen, -action.id]) doesn't work.
|
// map is just to clone the array since sort mutates it and it causes some issues
|
||||||
let sortedNotifications = sortBy(notificationsFromStore(store), ({action}) => -action.id)
|
let sortedNotifications = notificationsFromStore(store).map(_ => _).sort((a, b) => a.id > b.id ? -1 : 1)
|
||||||
sortedNotifications = sortBy(sortedNotifications, 'seen')
|
sortedNotifications = sortBy(sortedNotifications, 'seen')
|
||||||
return sortedNotifications.filter((notification) => visibleTypes(store).includes(notification.type))
|
return sortedNotifications.filter((notification) => visibleTypes(store).includes(notification.type))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue