aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/basic_user_card/basic_user_card.vue12
-rw-r--r--src/components/block_card/block_card.js2
-rw-r--r--src/components/follow_card/follow_card.js7
-rw-r--r--src/components/follow_card/follow_card.vue27
-rw-r--r--src/components/image_cropper/image_cropper.js18
-rw-r--r--src/components/image_cropper/image_cropper.vue7
-rw-r--r--src/components/mute_card/mute_card.js2
-rw-r--r--src/components/mute_card/mute_card.vue16
-rw-r--r--src/components/remote_follow/remote_follow.js10
-rw-r--r--src/components/remote_follow/remote_follow.vue24
-rw-r--r--src/components/settings/settings.js28
-rw-r--r--src/components/settings/settings.vue26
-rw-r--r--src/components/status/status.js8
-rw-r--r--src/components/user_avatar/user_avatar.js5
-rw-r--r--src/components/user_card/user_card.js29
-rw-r--r--src/components/user_card/user_card.vue19
-rw-r--r--src/components/user_profile/user_profile.js94
-rw-r--r--src/components/user_profile/user_profile.vue4
-rw-r--r--src/components/user_settings/user_settings.js8
-rw-r--r--src/components/user_settings/user_settings.vue6
20 files changed, 248 insertions, 104 deletions
diff --git a/src/components/basic_user_card/basic_user_card.vue b/src/components/basic_user_card/basic_user_card.vue
index 9b80c72b..8afe8b44 100644
--- a/src/components/basic_user_card/basic_user_card.vue
+++ b/src/components/basic_user_card/basic_user_card.vue
@@ -8,8 +8,8 @@
</div>
<div class="basic-user-card-collapsed-content" v-else>
<div :title="user.name" class="basic-user-card-user-name">
- <span v-if="user.name_html" v-html="user.name_html"></span>
- <span v-else>{{ user.name }}</span>
+ <span v-if="user.name_html" class="basic-user-card-user-name-value" v-html="user.name_html"></span>
+ <span v-else class="basic-user-card-user-name-value">{{ user.name }}</span>
</div>
<div>
<router-link class="basic-user-card-screen-name" :to="userProfileLink(user)">
@@ -52,6 +52,14 @@
width: 16px;
vertical-align: middle;
}
+
+ &-value {
+ display: inline-block;
+ max-width: 100%;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
}
&-expanded-content {
diff --git a/src/components/block_card/block_card.js b/src/components/block_card/block_card.js
index 11fa27b4..c459ff1b 100644
--- a/src/components/block_card/block_card.js
+++ b/src/components/block_card/block_card.js
@@ -9,7 +9,7 @@ const BlockCard = {
},
computed: {
user () {
- return this.$store.getters.userById(this.userId)
+ return this.$store.getters.findUser(this.userId)
},
blocked () {
return this.user.statusnet_blocking
diff --git a/src/components/follow_card/follow_card.js b/src/components/follow_card/follow_card.js
index 425c9c3e..ac4e265a 100644
--- a/src/components/follow_card/follow_card.js
+++ b/src/components/follow_card/follow_card.js
@@ -1,4 +1,5 @@
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
+import RemoteFollow from '../remote_follow/remote_follow.vue'
import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate'
const FollowCard = {
@@ -14,13 +15,17 @@ const FollowCard = {
}
},
components: {
- BasicUserCard
+ BasicUserCard,
+ RemoteFollow
},
computed: {
isMe () { return this.$store.state.users.currentUser.id === this.user.id },
following () { return this.updated ? this.updated.following : this.user.following },
showFollow () {
return !this.following || this.updated && !this.updated.following
+ },
+ loggedIn () {
+ return this.$store.state.users.currentUser
}
},
methods: {
diff --git a/src/components/follow_card/follow_card.vue b/src/components/follow_card/follow_card.vue
index 6cb064eb..9f314fd3 100644
--- a/src/components/follow_card/follow_card.vue
+++ b/src/components/follow_card/follow_card.vue
@@ -4,9 +4,12 @@
<span class="faint" v-if="!noFollowsYou && user.follows_you">
{{ isMe ? $t('user_card.its_you') : $t('user_card.follows_you') }}
</span>
+ <div class="follow-card-follow-button" v-if="showFollow && !loggedIn">
+ <RemoteFollow :user="user" />
+ </div>
<button
- v-if="showFollow"
- class="btn btn-default"
+ v-if="showFollow && loggedIn"
+ class="btn btn-default follow-card-follow-button"
@click="followUser"
:disabled="inProgress"
:title="requestSent ? $t('user_card.follow_again') : ''"
@@ -21,7 +24,7 @@
{{ $t('user_card.follow') }}
</template>
</button>
- <button v-if="following" class="btn btn-default pressed" @click="unfollowUser" :disabled="inProgress">
+ <button v-if="following" class="btn btn-default follow-card-follow-button pressed" @click="unfollowUser" :disabled="inProgress">
<template v-if="inProgress">
{{ $t('user_card.follow_progress') }}
</template>
@@ -36,15 +39,17 @@
<script src="./follow_card.js"></script>
<style lang="scss">
-.follow-card-content-container {
- flex-shrink: 0;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- flex-wrap: wrap;
- line-height: 1.5em;
+.follow-card {
+ &-content-container {
+ flex-shrink: 0;
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ flex-wrap: wrap;
+ line-height: 1.5em;
+ }
- .btn {
+ &-follow-button {
margin-top: 0.5em;
margin-left: auto;
width: 10em;
diff --git a/src/components/image_cropper/image_cropper.js b/src/components/image_cropper/image_cropper.js
index 49d51846..5ba8f04e 100644
--- a/src/components/image_cropper/image_cropper.js
+++ b/src/components/image_cropper/image_cropper.js
@@ -31,6 +31,9 @@ const ImageCropper = {
saveButtonLabel: {
type: String
},
+ saveWithoutCroppingButtonlabel: {
+ type: String
+ },
cancelButtonLabel: {
type: String
}
@@ -48,6 +51,9 @@ const ImageCropper = {
saveText () {
return this.saveButtonLabel || this.$t('image_cropper.save')
},
+ saveWithoutCroppingText () {
+ return this.saveWithoutCroppingButtonlabel || this.$t('image_cropper.save_without_cropping')
+ },
cancelText () {
return this.cancelButtonLabel || this.$t('image_cropper.cancel')
},
@@ -76,6 +82,18 @@ const ImageCropper = {
this.submitting = false
})
},
+ submitWithoutCropping () {
+ this.submitting = true
+ this.avatarUploadError = null
+ this.submitHandler(false, this.dataUrl)
+ .then(() => this.destroy())
+ .catch((err) => {
+ this.submitError = err
+ })
+ .finally(() => {
+ this.submitting = false
+ })
+ },
pickImage () {
this.$refs.input.click()
},
diff --git a/src/components/image_cropper/image_cropper.vue b/src/components/image_cropper/image_cropper.vue
index 24a6f3bd..129e6f46 100644
--- a/src/components/image_cropper/image_cropper.vue
+++ b/src/components/image_cropper/image_cropper.vue
@@ -7,6 +7,7 @@
<div class="image-cropper-buttons-wrapper">
<button class="btn" type="button" :disabled="submitting" @click="submit" v-text="saveText"></button>
<button class="btn" type="button" :disabled="submitting" @click="destroy" v-text="cancelText"></button>
+ <button class="btn" type="button" :disabled="submitting" @click="submitWithoutCropping" v-text="saveWithoutCroppingText"></button>
<i class="icon-spin4 animate-spin" v-if="submitting"></i>
</div>
<div class="alert error" v-if="submitError">
@@ -36,7 +37,11 @@
}
&-buttons-wrapper {
- margin-top: 15px;
+ margin-top: 10px;
+
+ button {
+ margin-top: 5px;
+ }
}
}
</style>
diff --git a/src/components/mute_card/mute_card.js b/src/components/mute_card/mute_card.js
index 5dd0a9e5..65c9cfb5 100644
--- a/src/components/mute_card/mute_card.js
+++ b/src/components/mute_card/mute_card.js
@@ -9,7 +9,7 @@ const MuteCard = {
},
computed: {
user () {
- return this.$store.getters.userById(this.userId)
+ return this.$store.getters.findUser(this.userId)
},
muted () {
return this.user.muted
diff --git a/src/components/mute_card/mute_card.vue b/src/components/mute_card/mute_card.vue
index e1bfe20b..a4edff03 100644
--- a/src/components/mute_card/mute_card.vue
+++ b/src/components/mute_card/mute_card.vue
@@ -1,6 +1,6 @@
<template>
<basic-user-card :user="user">
- <template slot="secondary-area">
+ <div class="mute-card-content-container">
<button class="btn btn-default" @click="unmuteUser" :disabled="progress" v-if="muted">
<template v-if="progress">
{{ $t('user_card.unmute_progress') }}
@@ -17,8 +17,18 @@
{{ $t('user_card.mute') }}
</template>
</button>
- </template>
+ </div>
</basic-user-card>
</template>
-<script src="./mute_card.js"></script> \ No newline at end of file
+<script src="./mute_card.js"></script>
+
+<style lang="scss">
+.mute-card-content-container {
+ margin-top: 0.5em;
+ text-align: right;
+ button {
+ width: 10em;
+ }
+}
+</style>
diff --git a/src/components/remote_follow/remote_follow.js b/src/components/remote_follow/remote_follow.js
new file mode 100644
index 00000000..461d58c9
--- /dev/null
+++ b/src/components/remote_follow/remote_follow.js
@@ -0,0 +1,10 @@
+export default {
+ props: [ 'user' ],
+ computed: {
+ subscribeUrl () {
+ // eslint-disable-next-line no-undef
+ const serverUrl = new URL(this.user.statusnet_profile_url)
+ return `${serverUrl.protocol}//${serverUrl.host}/main/ostatus`
+ }
+ }
+}
diff --git a/src/components/remote_follow/remote_follow.vue b/src/components/remote_follow/remote_follow.vue
new file mode 100644
index 00000000..fb2147bd
--- /dev/null
+++ b/src/components/remote_follow/remote_follow.vue
@@ -0,0 +1,24 @@
+<template>
+ <div class="remote-follow">
+ <form method="POST" :action='subscribeUrl'>
+ <input type="hidden" name="nickname" :value="user.screen_name">
+ <input type="hidden" name="profile" value="">
+ <button click="submit" class="remote-button">
+ {{ $t('user_card.remote_follow') }}
+ </button>
+ </form>
+ </div>
+</template>
+
+<script src="./remote_follow.js"></script>
+
+<style lang="scss">
+.remote-follow {
+ max-width: 220px;
+
+ .remote-button {
+ width: 100%;
+ min-height: 28px;
+ }
+}
+</style>
diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index 979457a5..1d5f75ed 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -1,8 +1,13 @@
/* eslint-env browser */
+import { filter, trim } from 'lodash'
+
import TabSwitcher from '../tab_switcher/tab_switcher.js'
import StyleSwitcher from '../style_switcher/style_switcher.vue'
import InterfaceLanguageSwitcher from '../interface_language_switcher/interface_language_switcher.vue'
-import { filter, trim } from 'lodash'
+import { extractCommit } from '../../services/version/version.service'
+
+const pleromaFeCommitUrl = 'https://git.pleroma.social/pleroma/pleroma-fe/commit/'
+const pleromaBeCommitUrl = 'https://git.pleroma.social/pleroma/pleroma/commit/'
const settings = {
data () {
@@ -42,6 +47,11 @@ const settings = {
pauseOnUnfocusedLocal: user.pauseOnUnfocused,
hoverPreviewLocal: user.hoverPreview,
+ hideMutedPostsLocal: typeof user.hideMutedPosts === 'undefined'
+ ? instance.hideMutedPosts
+ : user.hideMutedPosts,
+ hideMutedPostsDefault: this.$t('settings.values.' + instance.hideMutedPosts),
+
collapseMessageWithSubjectLocal: typeof user.collapseMessageWithSubject === 'undefined'
? instance.collapseMessageWithSubject
: user.collapseMessageWithSubject,
@@ -78,7 +88,10 @@ const settings = {
// Future spec, still not supported in Nightly 63 as of 08/2018
Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'audioTracks'),
playVideosInModal: user.playVideosInModal,
- useContainFit: user.useContainFit
+ useContainFit: user.useContainFit,
+
+ backendVersion: instance.backendVersion,
+ frontendVersion: instance.frontendVersion
}
},
components: {
@@ -96,7 +109,13 @@ const settings = {
postFormats () {
return this.$store.state.instance.postFormats || []
},
- instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel }
+ instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel },
+ frontendVersionLink () {
+ return pleromaFeCommitUrl + this.frontendVersion
+ },
+ backendVersionLink () {
+ return pleromaBeCommitUrl + extractCommit(this.backendVersion)
+ }
},
watch: {
hideAttachmentsLocal (value) {
@@ -163,6 +182,9 @@ const settings = {
value = filter(value.split('\n'), (word) => trim(word).length > 0)
this.$store.dispatch('setOption', { name: 'muteWords', value })
},
+ hideMutedPostsLocal (value) {
+ this.$store.dispatch('setOption', { name: 'hideMutedPosts', value })
+ },
collapseMessageWithSubjectLocal (value) {
this.$store.dispatch('setOption', { name: 'collapseMessageWithSubject', value })
},
diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index d2346747..33dad549 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -37,6 +37,10 @@
<h2>{{$t('nav.timeline')}}</h2>
<ul class="setting-list">
<li>
+ <input type="checkbox" id="hideMutedPosts" v-model="hideMutedPostsLocal">
+ <label for="hideMutedPosts">{{$t('settings.hide_muted_posts')}} {{$t('settings.instance_default', { value: hideMutedPostsDefault })}}</label>
+ </li>
+ <li>
<input type="checkbox" id="collapseMessageWithSubject" v-model="collapseMessageWithSubjectLocal">
<label for="collapseMessageWithSubject">
{{$t('settings.collapse_subject')}} {{$t('settings.instance_default', { value: collapseMessageWithSubjectDefault })}}
@@ -261,6 +265,28 @@
</div>
</div>
</div>
+ <div :label="$t('settings.version.title')" >
+ <div class="setting-item">
+ <ul class="setting-list">
+ <li>
+ <p>{{$t('settings.version.backend_version')}}</p>
+ <ul class="option-list">
+ <li>
+ <a :href="backendVersionLink" target="_blank">{{backendVersion}}</a>
+ </li>
+ </ul>
+ </li>
+ <li>
+ <p>{{$t('settings.version.frontend_version')}}</p>
+ <ul class="option-list">
+ <li>
+ <a :href="frontendVersionLink" target="_blank">{{frontendVersion}}</a>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ </div>
</tab-switcher>
</keep-alive>
</div>
diff --git a/src/components/status/status.js b/src/components/status/status.js
index 8e489704..550fe76f 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -145,11 +145,11 @@ const Status = {
return !!(this.status.in_reply_to_status_id && this.status.in_reply_to_user_id)
},
replyToName () {
- const user = this.$store.state.users.usersObject[this.status.in_reply_to_user_id]
- if (user) {
- return user.screen_name
- } else {
+ if (this.status.in_reply_to_screen_name) {
return this.status.in_reply_to_screen_name
+ } else {
+ const user = this.$store.getters.findUser(this.status.in_reply_to_user_id)
+ return user && user.screen_name
}
},
hideReply () {
diff --git a/src/components/user_avatar/user_avatar.js b/src/components/user_avatar/user_avatar.js
index e513b993..e6fed3b5 100644
--- a/src/components/user_avatar/user_avatar.js
+++ b/src/components/user_avatar/user_avatar.js
@@ -23,6 +23,11 @@ const UserAvatar = {
imageLoadError () {
this.showPlaceholder = true
}
+ },
+ watch: {
+ src () {
+ this.showPlaceholder = false
+ }
}
}
diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js
index 80d15a27..197c61d5 100644
--- a/src/components/user_card/user_card.js
+++ b/src/components/user_card/user_card.js
@@ -1,4 +1,5 @@
import UserAvatar from '../user_avatar/user_avatar.vue'
+import RemoteFollow from '../remote_follow/remote_follow.vue'
import { hex2rgb } from '../../services/color_convert/color_convert.js'
import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
@@ -15,6 +16,9 @@ export default {
betterShadow: this.$store.state.interface.browserSupport.cssFilter
}
},
+ created () {
+ this.$store.dispatch('fetchUserRelationship', this.user.id)
+ },
computed: {
classes () {
return [{
@@ -96,7 +100,8 @@ export default {
}
},
components: {
- UserAvatar
+ UserAvatar,
+ RemoteFollow
},
methods: {
followUser () {
@@ -116,24 +121,16 @@ export default {
})
},
blockUser () {
- const store = this.$store
- store.state.api.backendInteractor.blockUser(this.user.id)
- .then((blockedUser) => {
- store.commit('addNewUsers', [blockedUser])
- store.commit('removeStatus', { timeline: 'friends', userId: this.user.id })
- store.commit('removeStatus', { timeline: 'public', userId: this.user.id })
- store.commit('removeStatus', { timeline: 'publicAndExternal', userId: this.user.id })
- })
+ this.$store.dispatch('blockUser', this.user.id)
},
unblockUser () {
- const store = this.$store
- store.state.api.backendInteractor.unblockUser(this.user.id)
- .then((unblockedUser) => store.commit('addNewUsers', [unblockedUser]))
+ this.$store.dispatch('unblockUser', this.user.id)
},
- toggleMute () {
- const store = this.$store
- store.commit('setMuted', {user: this.user, muted: !this.user.muted})
- store.state.api.backendInteractor.setUserMute(this.user)
+ muteUser () {
+ this.$store.dispatch('muteUser', this.user.id)
+ },
+ unmuteUser () {
+ this.$store.dispatch('unmuteUser', this.user.id)
},
setProfileView (v) {
if (this.switcher) {
diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue
index 690e1bde..3259d1c5 100644
--- a/src/components/user_card/user_card.vue
+++ b/src/components/user_card/user_card.vue
@@ -74,24 +74,18 @@
</div>
<div class='mute' v-if='isOtherUser && loggedIn'>
<span v-if='user.muted'>
- <button @click="toggleMute" class="pressed">
+ <button @click="unmuteUser" class="pressed">
{{ $t('user_card.muted') }}
</button>
</span>
<span v-if='!user.muted'>
- <button @click="toggleMute">
+ <button @click="muteUser">
{{ $t('user_card.mute') }}
</button>
</span>
</div>
- <div class="remote-follow" v-if='!loggedIn && user.is_local'>
- <form method="POST" :action='subscribeUrl'>
- <input type="hidden" name="nickname" :value="user.screen_name">
- <input type="hidden" name="profile" value="">
- <button click="submit" class="remote-button">
- {{ $t('user_card.remote_follow') }}
- </button>
- </form>
+ <div v-if='!loggedIn && user.is_local'>
+ <RemoteFollow :user="user" />
</div>
<div class='block' v-if='isOtherUser && loggedIn'>
<span v-if='user.statusnet_blocking'>
@@ -375,11 +369,6 @@
min-height: 28px;
}
- .remote-follow {
- max-width: 220px;
- min-height: 28px;
- }
-
.follow {
max-width: 220px;
min-height: 28px;
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js
index 54126514..82df4510 100644
--- a/src/components/user_profile/user_profile.js
+++ b/src/components/user_profile/user_profile.js
@@ -9,7 +9,7 @@ import withList from '../../hocs/with_list/with_list'
const FollowerList = compose(
withLoadMore({
fetch: (props, $store) => $store.dispatch('addFollowers', props.userId),
- select: (props, $store) => get($store.getters.userById(props.userId), 'followers', []),
+ select: (props, $store) => get($store.getters.findUser(props.userId), 'followers', []),
destory: (props, $store) => $store.dispatch('clearFollowers', props.userId),
childPropName: 'entries',
additionalPropNames: ['userId']
@@ -20,7 +20,7 @@ const FollowerList = compose(
const FriendList = compose(
withLoadMore({
fetch: (props, $store) => $store.dispatch('addFriends', props.userId),
- select: (props, $store) => get($store.getters.userById(props.userId), 'friends', []),
+ select: (props, $store) => get($store.getters.findUser(props.userId), 'friends', []),
destory: (props, $store) => $store.dispatch('clearFriends', props.userId),
childPropName: 'entries',
additionalPropNames: ['userId']
@@ -31,28 +31,16 @@ const FriendList = compose(
const UserProfile = {
data () {
return {
- error: false
+ error: false,
+ fetchedUserId: null
}
},
created () {
- this.$store.commit('clearTimeline', { timeline: 'user' })
- this.$store.commit('clearTimeline', { timeline: 'favorites' })
- this.$store.commit('clearTimeline', { timeline: 'media' })
- this.$store.dispatch('startFetching', { timeline: 'user', userId: this.fetchBy })
- this.$store.dispatch('startFetching', { timeline: 'media', userId: this.fetchBy })
- this.startFetchFavorites()
if (!this.user.id) {
- this.$store.dispatch('fetchUser', this.fetchBy)
- .catch((reason) => {
- const errorMessage = get(reason, 'error.error')
- if (errorMessage === 'No user with such user_id') { // Known error
- this.error = this.$t('user_profile.profile_does_not_exist')
- } else if (errorMessage) {
- this.error = errorMessage
- } else {
- this.error = this.$t('user_profile.profile_loading_error')
- }
- })
+ this.fetchUserId()
+ .then(() => this.startUp())
+ } else {
+ this.startUp()
}
},
destroyed () {
@@ -69,7 +57,7 @@ const UserProfile = {
return this.$store.state.statuses.timelines.media
},
userId () {
- return this.$route.params.id || this.user.id
+ return this.$route.params.id || this.user.id || this.fetchedUserId
},
userName () {
return this.$route.params.name || this.user.screen_name
@@ -79,10 +67,9 @@ const UserProfile = {
this.userId === this.$store.state.users.currentUser.id
},
userInStore () {
- if (this.isExternal) {
- return this.$store.getters.userById(this.userId)
- }
- return this.$store.getters.userByName(this.userName)
+ const routeParams = this.$route.params
+ // This needs fetchedUserId so that computed will be refreshed when user is fetched
+ return this.$store.getters.findUser(this.fetchedUserId || routeParams.name || routeParams.id)
},
user () {
if (this.timeline.statuses[0]) {
@@ -93,9 +80,6 @@ const UserProfile = {
}
return {}
},
- fetchBy () {
- return this.isExternal ? this.userId : this.userName
- },
isExternal () {
return this.$route.name === 'external-user-profile'
},
@@ -109,14 +93,38 @@ const UserProfile = {
methods: {
startFetchFavorites () {
if (this.isUs) {
- this.$store.dispatch('startFetching', { timeline: 'favorites', userId: this.fetchBy })
+ this.$store.dispatch('startFetching', { timeline: 'favorites', userId: this.userId })
+ }
+ },
+ fetchUserId () {
+ let fetchPromise
+ if (this.userId && !this.$route.params.name) {
+ fetchPromise = this.$store.dispatch('fetchUser', this.userId)
+ } else {
+ fetchPromise = this.$store.dispatch('fetchUser', this.userName)
+ .then(({ id }) => {
+ this.fetchedUserId = id
+ })
}
+ return fetchPromise
+ .catch((reason) => {
+ const errorMessage = get(reason, 'error.error')
+ if (errorMessage === 'No user with such user_id') { // Known error
+ this.error = this.$t('user_profile.profile_does_not_exist')
+ } else if (errorMessage) {
+ this.error = errorMessage
+ } else {
+ this.error = this.$t('user_profile.profile_loading_error')
+ }
+ })
+ .then(() => this.startUp())
},
startUp () {
- this.$store.dispatch('startFetching', { timeline: 'user', userId: this.fetchBy })
- this.$store.dispatch('startFetching', { timeline: 'media', userId: this.fetchBy })
-
- this.startFetchFavorites()
+ if (this.userId) {
+ this.$store.dispatch('startFetching', { timeline: 'user', userId: this.userId })
+ this.$store.dispatch('startFetching', { timeline: 'media', userId: this.userId })
+ this.startFetchFavorites()
+ }
},
cleanUp () {
this.$store.dispatch('stopFetching', 'user')
@@ -128,19 +136,19 @@ const UserProfile = {
}
},
watch: {
- userName () {
- if (this.isExternal) {
- return
+ // userId can be undefined if we don't know it yet
+ userId (newVal) {
+ if (newVal) {
+ this.cleanUp()
+ this.startUp()
}
- this.cleanUp()
- this.startUp()
},
- userId () {
- if (!this.isExternal) {
- return
+ userName () {
+ if (this.$route.params.name) {
+ this.fetchUserId()
+ this.cleanUp()
+ this.startUp()
}
- this.cleanUp()
- this.startUp()
},
$route () {
this.$refs.tabSwitcher.activateTab(0)()
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index 7d4a8b1f..d449eb85 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -11,7 +11,7 @@
:title="$t('user_profile.timeline_title')"
:timeline="timeline"
:timeline-name="'user'"
- :user-id="fetchBy"
+ :user-id="userId"
/>
<div :label="$t('user_card.followees')" v-if="followsTabVisible" :disabled="!user.friends_count">
<FriendList :userId="userId" />
@@ -25,7 +25,7 @@
:embedded="true" :title="$t('user_card.media')"
timeline-name="media"
:timeline="media"
- :user-id="fetchBy"
+ :user-id="userId"
/>
<Timeline
v-if="isUs"
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index c0ab759c..72e7bb53 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -158,7 +158,13 @@ const UserSettings = {
reader.readAsDataURL(file)
},
submitAvatar (cropper, file) {
- const img = cropper.getCroppedCanvas().toDataURL(file.type)
+ let img
+ if (cropper) {
+ img = cropper.getCroppedCanvas().toDataURL(file.type)
+ } else {
+ img = file
+ }
+
return this.$store.state.api.backendInteractor.updateAvatar({ params: { img } }).then((user) => {
if (!user.error) {
this.$store.commit('addNewUsers', [user])
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index a1123638..c9e68808 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -192,6 +192,12 @@
<template slot="empty">{{$t('settings.no_blocks')}}</template>
</block-list>
</div>
+
+ <div :label="$t('settings.mutes_tab')">
+ <mute-list :refresh="true">
+ <template slot="empty">{{$t('settings.no_mutes')}}</template>
+ </mute-list>
+ </div>
</tab-switcher>
</div>
</div>