Compare commits
17 Commits
Author | SHA1 | Date |
---|---|---|
lain | 63088deb2e | |
lain | 1bfe811fc7 | |
lain | 22433cab90 | |
lain | 3ec664ce02 | |
lain | 2e131e5b22 | |
lain | 30149f55f4 | |
lain | 9b437c4e56 | |
lain | 2d9ab01575 | |
lain | c4d7331fd6 | |
lain | c1b28879f9 | |
lain | fe30bd6d04 | |
lain | 145b4e1e52 | |
lain | 7d5c3e5db0 | |
lain | 70db485a58 | |
lain | 6074f16f9b | |
lain | e3cf82b3be | |
lain | 20ada31498 |
|
@ -0,0 +1 @@
|
|||
nodejs 12.18.0
|
|
@ -35,7 +35,6 @@
|
|||
"vuex": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"karma-mocha-reporter": "^2.2.1",
|
||||
"@babel/core": "^7.7.5",
|
||||
"@babel/plugin-transform-runtime": "^7.7.6",
|
||||
"@babel/preset-env": "^7.7.6",
|
||||
|
@ -79,6 +78,7 @@
|
|||
"karma-coverage": "^1.1.1",
|
||||
"karma-firefox-launcher": "^1.1.0",
|
||||
"karma-mocha": "^1.2.0",
|
||||
"karma-mocha-reporter": "^2.2.1",
|
||||
"karma-sinon-chai": "^2.0.2",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-spec-reporter": "0.0.26",
|
||||
|
|
|
@ -20,7 +20,7 @@ const Attachment = {
|
|||
hideNsfwLocal: this.$store.getters.mergedConfig.hideNsfw,
|
||||
preloadImage: this.$store.getters.mergedConfig.preloadImage,
|
||||
loading: false,
|
||||
img: fileTypeService.fileType(this.attachment.mimetype) === 'image' && document.createElement('img'),
|
||||
img: fileTypeService.fileType(this.attachment.pleroma.mime_type) === 'image' && document.createElement('img'),
|
||||
modalOpen: false,
|
||||
showHidden: false
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ const Attachment = {
|
|||
return this.$store.state.instance.mediaProxyAvailable ? '' : 'no-referrer'
|
||||
},
|
||||
type () {
|
||||
return fileTypeService.fileType(this.attachment.mimetype)
|
||||
return fileTypeService.fileType(this.attachment.pleroma.mime_type)
|
||||
},
|
||||
hidden () {
|
||||
return this.nsfw && this.hideNsfwLocal && !this.showHidden
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
>
|
||||
<StillImage
|
||||
:referrerpolicy="referrerpolicy"
|
||||
:mimetype="attachment.mimetype"
|
||||
:mimetype="attachment.pleroma.mime_type"
|
||||
:src="attachment.large_thumb_url || attachment.url"
|
||||
:image-load-handler="onImageLoad"
|
||||
/>
|
||||
|
|
|
@ -20,7 +20,7 @@ const BasicUserCard = {
|
|||
this.userExpanded = !this.userExpanded
|
||||
},
|
||||
userProfileLink (user) {
|
||||
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
||||
return generateProfileLink(user.redux.id, user.redux.acct, this.$store.state.instance.restrictedNicknames)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
class="basic-user-card-expanded-content"
|
||||
>
|
||||
<UserCard
|
||||
:user-id="user.id"
|
||||
:user-id="user.redux.id"
|
||||
:rounded="true"
|
||||
:bordered="true"
|
||||
/>
|
||||
|
@ -22,27 +22,27 @@
|
|||
class="basic-user-card-collapsed-content"
|
||||
>
|
||||
<div
|
||||
:title="user.name"
|
||||
:title="user.redux.display_name"
|
||||
class="basic-user-card-user-name"
|
||||
>
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
<span
|
||||
v-if="user.name_html"
|
||||
v-if="user.redux.display_name_html"
|
||||
class="basic-user-card-user-name-value"
|
||||
v-html="user.name_html"
|
||||
v-html="user.redux.display_name_html"
|
||||
/>
|
||||
<!-- eslint-enable vue/no-v-html -->
|
||||
<span
|
||||
v-else
|
||||
class="basic-user-card-user-name-value"
|
||||
>{{ user.name }}</span>
|
||||
>{{ user.redux.display_name }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<router-link
|
||||
class="basic-user-card-screen-name"
|
||||
:to="userProfileLink(user)"
|
||||
>
|
||||
@{{ user.screen_name }}
|
||||
@{{ user.redux.acct }}
|
||||
</router-link>
|
||||
</div>
|
||||
<slot />
|
||||
|
|
|
@ -23,7 +23,7 @@ const chatPanel = {
|
|||
this.collapsed = !this.collapsed
|
||||
},
|
||||
userProfileLink (user) {
|
||||
return generateProfileLink(user.id, user.username, this.$store.state.instance.restrictedNicknames)
|
||||
return generateProfileLink(user.redux.id, user.redux.acct, this.$store.state.instance.restrictedNicknames)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ const FollowCard = {
|
|||
},
|
||||
computed: {
|
||||
isMe () {
|
||||
return this.$store.state.users.currentUser.id === this.user.id
|
||||
return this.$store.state.users.currentUser.id === this.user.redux.id
|
||||
},
|
||||
loggedIn () {
|
||||
return this.$store.state.users.currentUser
|
||||
|
|
|
@ -27,7 +27,7 @@ const MediaModal = {
|
|||
return this.media.length > 1
|
||||
},
|
||||
type () {
|
||||
return this.currentMedia ? fileTypeService.fileType(this.currentMedia.mimetype) : null
|
||||
return this.currentMedia ? fileTypeService.fileType(this.currentMedia.pleroma.mime_type) : null
|
||||
}
|
||||
},
|
||||
created () {
|
||||
|
|
|
@ -31,7 +31,7 @@ const Notification = {
|
|||
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
||||
},
|
||||
getUser (notification) {
|
||||
return this.$store.state.users.usersObject[notification.from_profile.id]
|
||||
return this.$store.state.users.usersObject[notification.account.id]
|
||||
},
|
||||
toggleMute () {
|
||||
this.unmuted = !this.unmuted
|
||||
|
@ -57,15 +57,15 @@ const Notification = {
|
|||
},
|
||||
computed: {
|
||||
userClass () {
|
||||
return highlightClass(this.notification.from_profile)
|
||||
return highlightClass(this.notification.account)
|
||||
},
|
||||
userStyle () {
|
||||
const highlight = this.$store.getters.mergedConfig.highlight
|
||||
const user = this.notification.from_profile
|
||||
const user = this.notification.account
|
||||
return highlightStyle(highlight[user.screen_name])
|
||||
},
|
||||
user () {
|
||||
return this.$store.getters.findUser(this.notification.from_profile.id)
|
||||
return this.$store.getters.findUser(this.notification.account.id)
|
||||
},
|
||||
userProfileLink () {
|
||||
return this.generateUserProfileLink(this.user)
|
||||
|
@ -80,7 +80,7 @@ const Notification = {
|
|||
return this.$store.getters.relationship(this.user.id).muting
|
||||
},
|
||||
isStatusNotification () {
|
||||
return isStatusNotification(this.notification.type)
|
||||
return (this.notification.type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
>
|
||||
<small>
|
||||
<router-link :to="userProfileLink">
|
||||
{{ notification.from_profile.screen_name }}
|
||||
{{ notification.account.redux.acct }}
|
||||
</router-link>
|
||||
</small>
|
||||
<a
|
||||
|
@ -28,13 +28,13 @@
|
|||
>
|
||||
<a
|
||||
class="avatar-container"
|
||||
:href="notification.from_profile.statusnet_profile_url"
|
||||
:href="notification.account.redux.url"
|
||||
@click.stop.prevent.capture="toggleUserExpanded"
|
||||
>
|
||||
<UserAvatar
|
||||
:compact="true"
|
||||
:better-shadow="betterShadow"
|
||||
:user="notification.from_profile"
|
||||
:user="notification.account"
|
||||
/>
|
||||
</a>
|
||||
<div class="notification-right">
|
||||
|
@ -48,22 +48,22 @@
|
|||
<div class="name-and-action">
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
<bdi
|
||||
v-if="!!notification.from_profile.name_html"
|
||||
v-if="!!notification.account.name_html"
|
||||
class="username"
|
||||
:title="'@'+notification.from_profile.screen_name"
|
||||
v-html="notification.from_profile.name_html"
|
||||
:title="'@'+notification.account.screen_name"
|
||||
v-html="notification.account.name_html"
|
||||
/>
|
||||
<!-- eslint-enable vue/no-v-html -->
|
||||
<span
|
||||
v-else
|
||||
class="username"
|
||||
:title="'@'+notification.from_profile.screen_name"
|
||||
>{{ notification.from_profile.name }}</span>
|
||||
<span v-if="notification.type === 'like'">
|
||||
:title="'@'+notification.account.redux.acct"
|
||||
>{{ notification.account.display_name }}</span>
|
||||
<span v-if="notification.type === 'favourite'">
|
||||
<i class="fa icon-star lit" />
|
||||
<small>{{ $t('notifications.favorited_you') }}</small>
|
||||
</span>
|
||||
<span v-if="notification.type === 'repeat'">
|
||||
<span v-if="notification.type === 'reblog'">
|
||||
<i
|
||||
class="fa icon-retweet lit"
|
||||
:title="$t('tool_tip.repeat')"
|
||||
|
@ -130,7 +130,7 @@
|
|||
:to="userProfileLink"
|
||||
class="follow-name"
|
||||
>
|
||||
@{{ notification.from_profile.screen_name }}
|
||||
@{{ notification.account.redux.acct }}
|
||||
</router-link>
|
||||
<div
|
||||
v-if="notification.type === 'follow_request'"
|
||||
|
@ -153,13 +153,13 @@
|
|||
class="move-text"
|
||||
>
|
||||
<router-link :to="targetUserProfileLink">
|
||||
@{{ notification.target.screen_name }}
|
||||
@{{ notification.target.redux.acct }}
|
||||
</router-link>
|
||||
</div>
|
||||
<template v-else>
|
||||
<status-content
|
||||
class="faint"
|
||||
:status="notification.action"
|
||||
:status="notification.status"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
v-for="notification in notificationsToDisplay"
|
||||
:key="notification.id"
|
||||
class="notification"
|
||||
:class="{"unseen": !minimalMode && !notification.seen}"
|
||||
:class="{"unseen": !minimalMode && !notification.pleroma.is_seen}"
|
||||
>
|
||||
<div class="notification-overlay" />
|
||||
<notification :notification="notification" />
|
||||
|
|
|
@ -51,12 +51,12 @@ const DataImportExportTab = {
|
|||
// Get addresses
|
||||
return users.map((user) => {
|
||||
// check is it's a local user
|
||||
if (user && user.is_local) {
|
||||
if (user && user.redux.is_local) {
|
||||
// append the instance address
|
||||
// eslint-disable-next-line no-undef
|
||||
return user.screen_name + '@' + location.hostname
|
||||
return user.redux.acct + '@' + location.hostname
|
||||
}
|
||||
return user.screen_name
|
||||
return user.redux.acct
|
||||
}).join('\n')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,12 +80,12 @@ const MutesAndBlocks = {
|
|||
// Get addresses
|
||||
return users.map((user) => {
|
||||
// check is it's a local user
|
||||
if (user && user.is_local) {
|
||||
if (user && user.redux.is_local) {
|
||||
// append the instance address
|
||||
// eslint-disable-next-line no-undef
|
||||
return user.screen_name + '@' + location.hostname
|
||||
return user.redux.acct + '@' + location.hostname
|
||||
}
|
||||
return user.screen_name
|
||||
return user.redux.acct
|
||||
}).join('\n')
|
||||
},
|
||||
activateTab (tabName) {
|
||||
|
@ -94,13 +94,13 @@ const MutesAndBlocks = {
|
|||
filterUnblockedUsers (userIds) {
|
||||
return reject(userIds, (userId) => {
|
||||
const relationship = this.$store.getters.relationship(this.userId)
|
||||
return relationship.blocking || userId === this.user.id
|
||||
return relationship.blocking || userId === this.user.redux.id
|
||||
})
|
||||
},
|
||||
filterUnMutedUsers (userIds) {
|
||||
return reject(userIds, (userId) => {
|
||||
const relationship = this.$store.getters.relationship(this.userId)
|
||||
return relationship.muting || userId === this.user.id
|
||||
return relationship.muting || userId === this.user.redux.id
|
||||
})
|
||||
},
|
||||
queryUserIds (query) {
|
||||
|
|
|
@ -102,8 +102,8 @@ const ProfileTab = {
|
|||
show_role: this.showRole
|
||||
/* eslint-enable camelcase */
|
||||
} }).then((user) => {
|
||||
this.newFields.splice(user.fields.length)
|
||||
merge(this.newFields, user.fields)
|
||||
this.newFields.splice(user.redux.fields.length)
|
||||
merge(this.newFields, user.redux.fields)
|
||||
this.$store.commit('addNewUsers', [user])
|
||||
this.$store.commit('setCurrentUser', user)
|
||||
})
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
</p>
|
||||
<p>{{ $t('settings.current_avatar') }}</p>
|
||||
<img
|
||||
:src="user.profile_image_url_original"
|
||||
:src="user.redux.avatar"
|
||||
class="current-avatar"
|
||||
>
|
||||
<p>{{ $t('settings.set_new_avatar') }}</p>
|
||||
|
@ -186,7 +186,7 @@
|
|||
<h2>{{ $t('settings.profile_banner') }}</h2>
|
||||
<p>{{ $t('settings.current_profile_banner') }}</p>
|
||||
<img
|
||||
:src="user.cover_photo"
|
||||
:src="user.redux.header"
|
||||
class="banner"
|
||||
>
|
||||
<p>{{ $t('settings.set_new_profile_banner') }}</p>
|
||||
|
|
|
@ -16,7 +16,7 @@ const UserAvatar = {
|
|||
},
|
||||
computed: {
|
||||
imgSrc () {
|
||||
return this.showPlaceholder ? '/images/avi.png' : this.user.profile_image_url_original
|
||||
return this.showPlaceholder ? '/images/avi.png' : this.user.redux.avatar
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -18,7 +18,7 @@ export default {
|
|||
}
|
||||
},
|
||||
created () {
|
||||
this.$store.dispatch('fetchUserRelationship', this.user.id)
|
||||
this.$store.dispatch('fetchUserRelationship', this.user.redux.id)
|
||||
},
|
||||
computed: {
|
||||
user () {
|
||||
|
@ -38,61 +38,61 @@ export default {
|
|||
return {
|
||||
backgroundImage: [
|
||||
`linear-gradient(to bottom, var(--profileTint), var(--profileTint))`,
|
||||
`url(${this.user.cover_photo})`
|
||||
`url(${this.user.redux.header})`
|
||||
].join(', ')
|
||||
}
|
||||
},
|
||||
isOtherUser () {
|
||||
return this.user.id !== this.$store.state.users.currentUser.id
|
||||
return this.user.redux.id !== this.$store.state.users.currentUser.id
|
||||
},
|
||||
subscribeUrl () {
|
||||
// eslint-disable-next-line no-undef
|
||||
const serverUrl = new URL(this.user.statusnet_profile_url)
|
||||
const serverUrl = new URL(this.user.redux.url)
|
||||
return `${serverUrl.protocol}//${serverUrl.host}/main/ostatus`
|
||||
},
|
||||
loggedIn () {
|
||||
return this.$store.state.users.currentUser
|
||||
},
|
||||
dailyAvg () {
|
||||
const days = Math.ceil((new Date() - new Date(this.user.created_at)) / (60 * 60 * 24 * 1000))
|
||||
return Math.round(this.user.statuses_count / days)
|
||||
const days = Math.ceil((new Date() - new Date(this.user.redux.created_at)) / (60 * 60 * 24 * 1000))
|
||||
return Math.round(this.user.redux.statuses_count / days)
|
||||
},
|
||||
userHighlightType: {
|
||||
get () {
|
||||
const data = this.$store.getters.mergedConfig.highlight[this.user.screen_name]
|
||||
const data = this.$store.getters.mergedConfig.highlight[this.user.redux.acct]
|
||||
return (data && data.type) || 'disabled'
|
||||
},
|
||||
set (type) {
|
||||
const data = this.$store.getters.mergedConfig.highlight[this.user.screen_name]
|
||||
const data = this.$store.getters.mergedConfig.highlight[this.user.redux.acct]
|
||||
if (type !== 'disabled') {
|
||||
this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: (data && data.color) || '#FFFFFF', type })
|
||||
this.$store.dispatch('setHighlight', { user: this.user.redux.acct, color: (data && data.color) || '#FFFFFF', type })
|
||||
} else {
|
||||
this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: undefined })
|
||||
this.$store.dispatch('setHighlight', { user: this.user.redux.acct, color: undefined })
|
||||
}
|
||||
},
|
||||
...mapGetters(['mergedConfig'])
|
||||
},
|
||||
userHighlightColor: {
|
||||
get () {
|
||||
const data = this.$store.getters.mergedConfig.highlight[this.user.screen_name]
|
||||
const data = this.$store.getters.mergedConfig.highlight[this.user.redux.acct]
|
||||
return data && data.color
|
||||
},
|
||||
set (color) {
|
||||
this.$store.dispatch('setHighlight', { user: this.user.screen_name, color })
|
||||
this.$store.dispatch('setHighlight', { user: this.user.redux.acct, color })
|
||||
}
|
||||
},
|
||||
visibleRole () {
|
||||
const rights = this.user.rights
|
||||
const rights = this.user.redux.pleroma
|
||||
if (!rights) { return }
|
||||
const validRole = rights.admin || rights.moderator
|
||||
const roleTitle = rights.admin ? 'admin' : 'moderator'
|
||||
const validRole = rights.is_admin || rights.is_moderator
|
||||
const roleTitle = rights.is_admin ? 'admin' : 'moderator'
|
||||
return validRole && roleTitle
|
||||
},
|
||||
hideFollowsCount () {
|
||||
return this.isOtherUser && this.user.hide_follows_count
|
||||
return this.isOtherUser && this.user.redux.hide_follows_count
|
||||
},
|
||||
hideFollowersCount () {
|
||||
return this.isOtherUser && this.user.hide_followers_count
|
||||
return this.isOtherUser && this.user.redux.hide_followers_count
|
||||
},
|
||||
...mapGetters(['mergedConfig'])
|
||||
},
|
||||
|
@ -106,16 +106,16 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
muteUser () {
|
||||
this.$store.dispatch('muteUser', this.user.id)
|
||||
this.$store.dispatch('muteUser', this.user.redux.id)
|
||||
},
|
||||
unmuteUser () {
|
||||
this.$store.dispatch('unmuteUser', this.user.id)
|
||||
this.$store.dispatch('unmuteUser', this.user.redux.id)
|
||||
},
|
||||
subscribeUser () {
|
||||
return this.$store.dispatch('subscribeUser', this.user.id)
|
||||
return this.$store.dispatch('subscribeUser', this.user.redux.id)
|
||||
},
|
||||
unsubscribeUser () {
|
||||
return this.$store.dispatch('unsubscribeUser', this.user.id)
|
||||
return this.$store.dispatch('unsubscribeUser', this.user.redux.id)
|
||||
},
|
||||
setProfileView (v) {
|
||||
if (this.switcher) {
|
||||
|
@ -133,14 +133,16 @@ export default {
|
|||
},
|
||||
userProfileLink (user) {
|
||||
return generateProfileLink(
|
||||
user.id, user.screen_name,
|
||||
user.redux.id, user.redux.acct,
|
||||
this.$store.state.instance.restrictedNicknames
|
||||
)
|
||||
},
|
||||
zoomAvatar () {
|
||||
const attachment = {
|
||||
url: this.user.profile_image_url_original,
|
||||
mimetype: 'image'
|
||||
url: this.user.redux.avatar,
|
||||
pleroma: {
|
||||
mime_type: 'image'
|
||||
}
|
||||
}
|
||||
this.$store.dispatch('setMedia', [attachment])
|
||||
this.$store.dispatch('setCurrent', attachment)
|
||||
|
|
|
@ -37,22 +37,22 @@
|
|||
<div class="top-line">
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
<div
|
||||
v-if="user.name_html"
|
||||
:title="user.name"
|
||||
v-if="user.redux.display_name_html"
|
||||
:title="user.redux.display_name"
|
||||
class="user-name"
|
||||
v-html="user.name_html"
|
||||
v-html="user.redux.display_name_html"
|
||||
/>
|
||||
<!-- eslint-enable vue/no-v-html -->
|
||||
<div
|
||||
v-else
|
||||
:title="user.name"
|
||||
:title="user.redux.display_name"
|
||||
class="user-name"
|
||||
>
|
||||
{{ user.name }}
|
||||
{{ user.redux.display_name }}
|
||||
</div>
|
||||
<a
|
||||
v-if="isOtherUser && !user.is_local"
|
||||
:href="user.statusnet_profile_url"
|
||||
v-if="isOtherUser && !user.redux.is_local"
|
||||
:href="user.redux.url"
|
||||
target="_blank"
|
||||
>
|
||||
<i class="icon-link-ext usersettings" />
|
||||
|
@ -68,7 +68,7 @@
|
|||
class="user-screen-name"
|
||||
:to="userProfileLink(user)"
|
||||
>
|
||||
@{{ user.screen_name }}
|
||||
@{{ user.redux.acct }}
|
||||
</router-link>
|
||||
<template v-if="!hideBio">
|
||||
<span
|
||||
|
@ -78,13 +78,13 @@
|
|||
{{ visibleRole }}
|
||||
</span>
|
||||
<span
|
||||
v-if="user.bot"
|
||||
v-if="user.redux.bot"
|
||||
class="alert user-role"
|
||||
>
|
||||
bot
|
||||
</span>
|
||||
</template>
|
||||
<span v-if="user.locked"><i class="icon icon-lock" /></span>
|
||||
<span v-if="user.redux.locked"><i class="icon icon-lock" /></span>
|
||||
<span
|
||||
v-if="!mergedConfig.hideUserStats && !hideBio"
|
||||
class="dailyAvg"
|
||||
|
@ -106,14 +106,14 @@
|
|||
<!-- id's need to be unique, otherwise vue confuses which user-card checkbox belongs to -->
|
||||
<input
|
||||
v-if="userHighlightType !== 'disabled'"
|
||||
:id="'userHighlightColorTx'+user.id"
|
||||
:id="'userHighlightColorTx'+user.redux.id"
|
||||
v-model="userHighlightColor"
|
||||
class="userHighlightText"
|
||||
type="text"
|
||||
>
|
||||
<input
|
||||
v-if="userHighlightType !== 'disabled'"
|
||||
:id="'userHighlightColor'+user.id"
|
||||
:id="'userHighlightColor'+user.redux.id"
|
||||
v-model="userHighlightColor"
|
||||
class="userHighlightCl"
|
||||
type="color"
|
||||
|
@ -123,7 +123,7 @@
|
|||
class="userHighlightSel select"
|
||||
>
|
||||
<select
|
||||
:id="'userHighlightSel'+user.id"
|
||||
:id="'userHighlightSel'+user.redux.id"
|
||||
v-model="userHighlightType"
|
||||
class="userHighlightSel"
|
||||
>
|
||||
|
@ -191,7 +191,7 @@
|
|||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="!loggedIn && user.is_local"
|
||||
v-if="!loggedIn && user.redux.is_local"
|
||||
class="user-interactions"
|
||||
>
|
||||
<RemoteFollow :user="user" />
|
||||
|
@ -211,36 +211,36 @@
|
|||
@click.prevent="setProfileView('statuses')"
|
||||
>
|
||||
<h5>{{ $t('user_card.statuses') }}</h5>
|
||||
<span>{{ user.statuses_count }} <br></span>
|
||||
<span>{{ user.redux.statuses_count }} <br></span>
|
||||
</div>
|
||||
<div
|
||||
class="user-count"
|
||||
@click.prevent="setProfileView('friends')"
|
||||
>
|
||||
<h5>{{ $t('user_card.followees') }}</h5>
|
||||
<span>{{ hideFollowsCount ? $t('user_card.hidden') : user.friends_count }}</span>
|
||||
<span>{{ hideFollowsCount ? $t('user_card.hidden') : user.redux.following_count }}</span>
|
||||
</div>
|
||||
<div
|
||||
class="user-count"
|
||||
@click.prevent="setProfileView('followers')"
|
||||
>
|
||||
<h5>{{ $t('user_card.followers') }}</h5>
|
||||
<span>{{ hideFollowersCount ? $t('user_card.hidden') : user.followers_count }}</span>
|
||||
<span>{{ hideFollowersCount ? $t('user_card.hidden') : user.redux.followers_count }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
<p
|
||||
v-if="!hideBio && user.description_html"
|
||||
v-if="!hideBio && user.redux.note_html"
|
||||
class="user-card-bio"
|
||||
@click.prevent="linkClicked"
|
||||
v-html="user.description_html"
|
||||
v-html="user.redux.note_html"
|
||||
/>
|
||||
<!-- eslint-enable vue/no-v-html -->
|
||||
<p
|
||||
v-else-if="!hideBio"
|
||||
class="user-card-bio"
|
||||
>
|
||||
{{ user.description }}
|
||||
{{ user.redux.note }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@ import { mapState } from 'vuex'
|
|||
|
||||
const UserPanel = {
|
||||
computed: {
|
||||
signedIn () { return this.user },
|
||||
signedIn () { return this.redux.user },
|
||||
...mapState({ user: state => state.users.currentUser })
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -12,23 +12,23 @@
|
|||
rounded="top"
|
||||
/>
|
||||
<div
|
||||
v-if="user.fields_html && user.fields_html.length > 0"
|
||||
v-if="user.redux.fields_html && user.redux.fields_html.length > 0"
|
||||
class="user-profile-fields"
|
||||
>
|
||||
<dl
|
||||
v-for="(field, index) in user.fields_html"
|
||||
v-for="(field, index) in user.redux.fields_html"
|
||||
:key="index"
|
||||
class="user-profile-field"
|
||||
>
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
<dt
|
||||
:title="user.fields_text[index].name"
|
||||
:title="user.redux.fields_text[index].name"
|
||||
class="user-profile-field-name"
|
||||
@click.prevent="linkClicked"
|
||||
v-html="field.name"
|
||||
/>
|
||||
<dd
|
||||
:title="user.fields_text[index].value"
|
||||
:title="user.redux.fields_text[index].value"
|
||||
class="user-profile-field-value"
|
||||
@click.prevent="linkClicked"
|
||||
v-html="field.value"
|
||||
|
@ -44,7 +44,7 @@
|
|||
<Timeline
|
||||
key="statuses"
|
||||
:label="$t('user_card.statuses')"
|
||||
:count="user.statuses_count"
|
||||
:count="user.redux.statuses_count"
|
||||
:embedded="true"
|
||||
:title="$t('user_profile.timeline_title')"
|
||||
:timeline="timeline"
|
||||
|
@ -57,7 +57,7 @@
|
|||
v-if="followsTabVisible"
|
||||
key="followees"
|
||||
:label="$t('user_card.followees')"
|
||||
:disabled="!user.friends_count"
|
||||
:disabled="!user.redux.following_count"
|
||||
>
|
||||
<FriendList :user-id="userId">
|
||||
<template
|
||||
|
@ -72,7 +72,7 @@
|
|||
v-if="followersTabVisible"
|
||||
key="followers"
|
||||
:label="$t('user_card.followers')"
|
||||
:disabled="!user.followers_count"
|
||||
:disabled="!user.redux.followers_count"
|
||||
>
|
||||
<FollowerList :user-id="userId">
|
||||
<template
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class="panel-body">
|
||||
<FollowCard
|
||||
v-for="user in users"
|
||||
:key="user.id"
|
||||
:key="user.redux.id"
|
||||
:user="user"
|
||||
class="list-item"
|
||||
/>
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
<div class="who-to-follow">
|
||||
<p
|
||||
v-for="user in usersToFollow"
|
||||
:key="user.id"
|
||||
:key="user.redux.id"
|
||||
class="who-to-follow-items"
|
||||
>
|
||||
<img :src="user.img">
|
||||
<router-link :to="userProfileLink(user.id, user.name)">
|
||||
{{ user.name }}
|
||||
<img :src="user.redux.avatar">
|
||||
<router-link :to="userProfileLink(user.redux.id, user.redux.display_name)">
|
||||
{{ user.redux.display_name }}
|
||||
</router-link><br>
|
||||
</p>
|
||||
<p class="who-to-follow-more">
|
||||
|
|
|
@ -21,7 +21,7 @@ const mediaViewer = {
|
|||
actions: {
|
||||
setMedia ({ commit }, attachments) {
|
||||
const media = attachments.filter(attachment => {
|
||||
const type = fileTypeService.fileType(attachment.mimetype)
|
||||
const type = fileTypeService.fileType(attachment.pleroma.mime_type)
|
||||
return type === 'image' || type === 'video'
|
||||
})
|
||||
commit('setMedia', media)
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
omitBy
|
||||
} from 'lodash'
|
||||
import { set } from 'vue'
|
||||
import { isStatusNotification, prepareNotificationObject } from '../services/notification_utils/notification_utils.js'
|
||||
import { isStatusNotification, prepareNotificationObject, visibleTypes } from '../services/notification_utils/notification_utils.js'
|
||||
import apiService from '../services/api/api.service.js'
|
||||
import { muteWordHits } from '../services/status_parser/status_parser.js'
|
||||
|
||||
|
@ -76,17 +76,6 @@ export const prepareStatus = (status) => {
|
|||
return status
|
||||
}
|
||||
|
||||
const visibleNotificationTypes = (rootState) => {
|
||||
return [
|
||||
rootState.config.notificationVisibility.likes && 'like',
|
||||
rootState.config.notificationVisibility.mentions && 'mention',
|
||||
rootState.config.notificationVisibility.repeats && 'repeat',
|
||||
rootState.config.notificationVisibility.follows && 'follow',
|
||||
rootState.config.notificationVisibility.moves && 'move',
|
||||
rootState.config.notificationVisibility.emojiReactions && 'pleroma:emoji_reactions'
|
||||
].filter(_ => _)
|
||||
}
|
||||
|
||||
const mergeOrAdd = (arr, obj, item) => {
|
||||
const oldItem = obj[item.id]
|
||||
|
||||
|
@ -323,7 +312,6 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
|
|||
const addNewNotifications = (state, { dispatch, notifications, older, visibleNotificationTypes, rootGetters }) => {
|
||||
each(notifications, (notification) => {
|
||||
if (isStatusNotification(notification.type)) {
|
||||
notification.action = addStatusToGlobalStorage(state, notification.action).item
|
||||
notification.status = notification.status && addStatusToGlobalStorage(state, notification.status).item
|
||||
}
|
||||
|
||||
|
@ -347,7 +335,7 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
|
|||
const notifObj = prepareNotificationObject(notification, rootGetters.i18n)
|
||||
|
||||
const reasonsToMuteNotif = (
|
||||
notification.seen ||
|
||||
notification.pleroma.is_seen ||
|
||||
state.notifications.desktopNotificationSilence ||
|
||||
!visibleNotificationTypes.includes(notification.type) ||
|
||||
(
|
||||
|
@ -364,8 +352,8 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
|
|||
setTimeout(desktopNotification.close.bind(desktopNotification), 5000)
|
||||
}
|
||||
}
|
||||
} else if (notification.seen) {
|
||||
state.notifications.idStore[notification.id].seen = true
|
||||
} else if (notification.pleroma.is_seen) {
|
||||
state.notifications.idStore[notification.id].pleroma.is_seen = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -498,12 +486,12 @@ export const mutations = {
|
|||
},
|
||||
markNotificationsAsSeen (state) {
|
||||
each(state.notifications.data, (notification) => {
|
||||
notification.seen = true
|
||||
notification.pleroma.is_seen = true
|
||||
})
|
||||
},
|
||||
markSingleNotificationAsSeen (state, { id }) {
|
||||
const notification = find(state.notifications.data, n => n.id === id)
|
||||
if (notification) notification.seen = true
|
||||
if (notification) notification.pleroma.is_seen = true
|
||||
},
|
||||
dismissNotification (state, { id }) {
|
||||
state.notifications.data = state.notifications.data.filter(n => n.id !== id)
|
||||
|
@ -589,7 +577,7 @@ const statuses = {
|
|||
commit('addNewStatuses', { statuses, showImmediately, timeline, noIdUpdate, user: rootState.users.currentUser, userId })
|
||||
},
|
||||
addNewNotifications ({ rootState, commit, dispatch, rootGetters }, { notifications, older }) {
|
||||
commit('addNewNotifications', { visibleNotificationTypes: visibleNotificationTypes(rootState), dispatch, notifications, older, rootGetters })
|
||||
commit('addNewNotifications', { visibleNotificationTypes: visibleTypes(rootState), dispatch, notifications, older, rootGetters })
|
||||
},
|
||||
setError ({ rootState, commit }, { value }) {
|
||||
commit('setError', { value })
|
||||
|
|
|
@ -213,10 +213,7 @@ export const mutations = {
|
|||
status.user = state.usersObject[status.user.id]
|
||||
},
|
||||
setUserForNotification (state, notification) {
|
||||
if (notification.type !== 'follow') {
|
||||
notification.action.user = state.usersObject[notification.action.user.id]
|
||||
}
|
||||
notification.from_profile = state.usersObject[notification.from_profile.id]
|
||||
notification.account = state.usersObject[notification.account.id]
|
||||
},
|
||||
setColor (state, { user: { id }, highlighted }) {
|
||||
const user = state.usersObject[id]
|
||||
|
@ -419,7 +416,7 @@ const users = {
|
|||
})
|
||||
},
|
||||
addNewNotifications (store, { notifications }) {
|
||||
const users = map(notifications, 'from_profile')
|
||||
const users = map(notifications, 'account')
|
||||
const targetUsers = map(notifications, 'target').filter(_ => _)
|
||||
const notificationIds = notifications.map(_ => _.id)
|
||||
store.commit('addNewUsers', users)
|
||||
|
|
|
@ -188,27 +188,30 @@ export const parseUser = (data) => {
|
|||
output.rights = output.rights || {}
|
||||
output.notification_settings = output.notification_settings || {}
|
||||
|
||||
output.redux = data
|
||||
output.redux.display_name_html = addEmojis(escape(data.display_name), data.emojis)
|
||||
output.redux.note_html = addEmojis(data.note, data.emojis)
|
||||
|
||||
output.redux.fields_html = data.fields.map(field => {
|
||||
return {
|
||||
name: addEmojis(field.name, data.emojis),
|
||||
value: addEmojis(field.value, data.emojis)
|
||||
}
|
||||
})
|
||||
output.redux.fields_text = data.fields.map(field => {
|
||||
return {
|
||||
name: unescape(field.name.replace(/<[^>]*>/g, '')),
|
||||
value: unescape(field.value.replace(/<[^>]*>/g, ''))
|
||||
}
|
||||
})
|
||||
|
||||
output.redux.is_local = !data.acct.includes('@')
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
export const parseAttachment = (data) => {
|
||||
const output = {}
|
||||
const masto = !data.hasOwnProperty('oembed')
|
||||
|
||||
if (masto) {
|
||||
// Not exactly same...
|
||||
output.mimetype = data.pleroma ? data.pleroma.mime_type : data.type
|
||||
output.meta = data.meta // not present in BE yet
|
||||
output.id = data.id
|
||||
} else {
|
||||
output.mimetype = data.mimetype
|
||||
// output.meta = ??? missing
|
||||
}
|
||||
|
||||
output.url = data.url
|
||||
output.description = data.description
|
||||
|
||||
return output
|
||||
return data
|
||||
}
|
||||
export const addEmojis = (string, emojis) => {
|
||||
const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g
|
||||
|
@ -343,38 +346,12 @@ export const parseStatus = (data) => {
|
|||
}
|
||||
|
||||
export const parseNotification = (data) => {
|
||||
const mastoDict = {
|
||||
'favourite': 'like',
|
||||
'reblog': 'repeat'
|
||||
}
|
||||
const masto = !data.hasOwnProperty('ntype')
|
||||
const output = {}
|
||||
const redux = data
|
||||
redux.account = parseUser(data.account)
|
||||
redux.status = isStatusNotification(data.type) ? parseStatus(data.status) : null
|
||||
redux.target = data.type !== 'move' ? null : parseUser(data.target)
|
||||
|
||||
if (masto) {
|
||||
output.type = mastoDict[data.type] || data.type
|
||||
output.seen = data.pleroma.is_seen
|
||||
output.status = isStatusNotification(output.type) ? parseStatus(data.status) : null
|
||||
output.action = output.status // TODO: Refactor, this is unneeded
|
||||
output.target = output.type !== 'move'
|
||||
? null
|
||||
: parseUser(data.target)
|
||||
output.from_profile = parseUser(data.account)
|
||||
output.emoji = data.emoji
|
||||
} else {
|
||||
const parsedNotice = parseStatus(data.notice)
|
||||
output.type = data.ntype
|
||||
output.seen = Boolean(data.is_seen)
|
||||
output.status = output.type === 'like'
|
||||
? parseStatus(data.notice.favorited_status)
|
||||
: parsedNotice
|
||||
output.action = parsedNotice
|
||||
output.from_profile = parseUser(data.from_profile)
|
||||
}
|
||||
|
||||
output.created_at = new Date(data.created_at)
|
||||
output.id = parseInt(data.id)
|
||||
|
||||
return output
|
||||
return redux
|
||||
}
|
||||
|
||||
const isNsfw = (status) => {
|
||||
|
|
|
@ -22,7 +22,7 @@ const fileType = mimetype => {
|
|||
}
|
||||
|
||||
const fileMatchesSomeType = (types, file) =>
|
||||
types.some(type => fileType(file.mimetype) === type)
|
||||
types.some(type => fileType(file.pleroma.mime_type) === type)
|
||||
|
||||
const fileTypeService = {
|
||||
fileType,
|
||||
|
|
|
@ -2,17 +2,17 @@ import { filter, sortBy, includes } from 'lodash'
|
|||
|
||||
export const notificationsFromStore = store => store.state.statuses.notifications.data
|
||||
|
||||
export const visibleTypes = store => ([
|
||||
store.state.config.notificationVisibility.likes && 'like',
|
||||
store.state.config.notificationVisibility.mentions && 'mention',
|
||||
store.state.config.notificationVisibility.repeats && 'repeat',
|
||||
store.state.config.notificationVisibility.follows && 'follow',
|
||||
store.state.config.notificationVisibility.followRequest && 'follow_request',
|
||||
store.state.config.notificationVisibility.moves && 'move',
|
||||
store.state.config.notificationVisibility.emojiReactions && 'pleroma:emoji_reaction'
|
||||
export const visibleTypes = state => ([
|
||||
state.config.notificationVisibility.likes && 'favourite',
|
||||
state.config.notificationVisibility.mentions && 'mention',
|
||||
state.config.notificationVisibility.repeats && 'reblog',
|
||||
state.config.notificationVisibility.follows && 'follow',
|
||||
state.config.notificationVisibility.followRequest && 'follow_request',
|
||||
state.config.notificationVisibility.moves && 'move',
|
||||
state.config.notificationVisibility.emojiReactions && 'pleroma:emoji_reaction'
|
||||
].filter(_ => _))
|
||||
|
||||
const statusNotifications = ['like', 'mention', 'repeat', 'pleroma:emoji_reaction']
|
||||
const statusNotifications = ['favourite', 'mention', 'reblog', 'pleroma:emoji_reaction']
|
||||
|
||||
export const isStatusNotification = (type) => includes(statusNotifications, type)
|
||||
|
||||
|
@ -35,29 +35,29 @@ const sortById = (a, b) => {
|
|||
export const filteredNotificationsFromStore = (store, types) => {
|
||||
// map is just to clone the array since sort mutates it and it causes some issues
|
||||
let sortedNotifications = notificationsFromStore(store).map(_ => _).sort(sortById)
|
||||
sortedNotifications = sortBy(sortedNotifications, 'seen')
|
||||
sortedNotifications = sortBy(sortedNotifications, 'pleroma.is_seen')
|
||||
return sortedNotifications.filter(
|
||||
(notification) => (types || visibleTypes(store)).includes(notification.type)
|
||||
(notification) => (types || visibleTypes(store.state)).includes(notification.type)
|
||||
)
|
||||
}
|
||||
|
||||
export const unseenNotificationsFromStore = store =>
|
||||
filter(filteredNotificationsFromStore(store), ({ seen }) => !seen)
|
||||
filter(filteredNotificationsFromStore(store), ({ pleroma }) => !pleroma.is_seen)
|
||||
|
||||
export const prepareNotificationObject = (notification, i18n) => {
|
||||
const notifObj = {
|
||||
tag: notification.id
|
||||
}
|
||||
const status = notification.status
|
||||
const title = notification.from_profile.name
|
||||
const title = notification.account.name
|
||||
notifObj.title = title
|
||||
notifObj.icon = notification.from_profile.profile_image_url
|
||||
notifObj.icon = notification.account.profile_image_url
|
||||
let i18nString
|
||||
switch (notification.type) {
|
||||
case 'like':
|
||||
case 'favourite':
|
||||
i18nString = 'favorited_you'
|
||||
break
|
||||
case 'repeat':
|
||||
case 'reblog':
|
||||
i18nString = 'repeated_you'
|
||||
break
|
||||
case 'follow':
|
||||
|
@ -81,7 +81,7 @@ export const prepareNotificationObject = (notification, i18n) => {
|
|||
|
||||
// Shows first attached non-nsfw image, if any. Should add configuration for this somehow...
|
||||
if (status && status.attachments && status.attachments.length > 0 && !status.nsfw &&
|
||||
status.attachments[0].mimetype.startsWith('image/')) {
|
||||
status.attachments[0].pleroma.mime_type.startsWith('image/')) {
|
||||
notifObj.image = status.attachments[0].url
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue