2018-10-26 11:08:46 +00:00
|
|
|
<!--
|
|
|
|
- @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
|
|
|
|
-
|
|
|
|
- @author Julius Härtl <jus@bitgrid.net>
|
|
|
|
-
|
|
|
|
- @license GNU AGPL version 3 or any later version
|
|
|
|
-
|
|
|
|
- This program is free software: you can redistribute it and/or modify
|
|
|
|
- it under the terms of the GNU Affero General Public License as
|
|
|
|
- published by the Free Software Foundation, either version 3 of the
|
|
|
|
- License, or (at your option) any later version.
|
|
|
|
-
|
|
|
|
- This program is distributed in the hope that it will be useful,
|
|
|
|
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
- GNU Affero General Public License for more details.
|
|
|
|
-
|
|
|
|
- You should have received a copy of the GNU Affero General Public License
|
|
|
|
- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
-
|
|
|
|
-->
|
|
|
|
|
|
|
|
<template>
|
2018-11-29 10:51:22 +00:00
|
|
|
<div v-if="item" class="user-entry">
|
2018-10-26 11:08:46 +00:00
|
|
|
<div class="entry-content">
|
|
|
|
<div class="user-avatar">
|
2018-12-05 10:26:24 +00:00
|
|
|
<avatar v-if="item.local" :size="32" :user="item.preferredUsername"
|
2019-01-09 14:59:59 +00:00
|
|
|
:disable-tooltip="true" />
|
2018-12-03 09:02:46 +00:00
|
|
|
<avatar v-else :url="avatarUrl" />
|
2018-10-26 11:08:46 +00:00
|
|
|
</div>
|
|
|
|
<div class="user-details">
|
2018-12-21 16:33:29 +00:00
|
|
|
<router-link v-if="!serverData.public" :to="{ name: 'profile', params: { account: item.local ? item.preferredUsername : item.account }}">
|
2019-01-02 23:25:44 +00:00
|
|
|
<span class="post-author">
|
|
|
|
{{ item.name }}
|
|
|
|
</span>
|
|
|
|
<span class="user-description">
|
|
|
|
{{ item.account }}
|
|
|
|
</span>
|
2018-10-26 11:08:46 +00:00
|
|
|
</router-link>
|
2018-11-28 21:52:27 +00:00
|
|
|
<a v-else :href="item.id" target="_blank"
|
2019-01-09 14:59:59 +00:00
|
|
|
rel="noreferrer">
|
2019-01-02 23:25:44 +00:00
|
|
|
<span class="post-author">
|
|
|
|
{{ item.name }}
|
|
|
|
</span>
|
|
|
|
<span class="user-description">
|
|
|
|
{{ item.account }}
|
|
|
|
</span>
|
2018-12-21 16:33:29 +00:00
|
|
|
</a>
|
2019-01-02 23:25:44 +00:00
|
|
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
2018-11-29 10:51:22 +00:00
|
|
|
<p v-html="item.summary" />
|
2018-10-26 11:08:46 +00:00
|
|
|
</div>
|
2018-12-21 16:33:29 +00:00
|
|
|
<follow-button :account="item.account" />
|
2018-10-26 11:08:46 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-11-05 15:41:02 +00:00
|
|
|
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
|
2018-11-29 10:51:22 +00:00
|
|
|
import follow from '../mixins/follow'
|
2018-12-05 08:48:02 +00:00
|
|
|
import currentUser from '../mixins/currentUserMixin'
|
2019-09-09 14:16:40 +00:00
|
|
|
import FollowButton from './FollowButton.vue'
|
2020-10-09 16:16:40 +00:00
|
|
|
import { generateUrl } from '@nextcloud/router'
|
2018-10-26 11:08:46 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'UserEntry',
|
|
|
|
components: {
|
2018-12-21 16:33:29 +00:00
|
|
|
FollowButton,
|
2018-10-26 11:08:46 +00:00
|
|
|
Avatar
|
|
|
|
},
|
2018-11-29 10:51:22 +00:00
|
|
|
mixins: [
|
2018-12-05 08:48:02 +00:00
|
|
|
follow,
|
|
|
|
currentUser
|
2018-11-29 10:51:22 +00:00
|
|
|
],
|
2018-10-26 11:08:46 +00:00
|
|
|
props: {
|
|
|
|
item: { type: Object, default: () => {} }
|
|
|
|
},
|
|
|
|
data: function() {
|
|
|
|
return {
|
2018-11-29 10:51:22 +00:00
|
|
|
followingText: t('social', 'Following')
|
2018-10-26 11:08:46 +00:00
|
|
|
}
|
2018-12-03 09:02:46 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
id() {
|
|
|
|
if (this.item.actor_info) {
|
|
|
|
return this.item.actor_info.id
|
|
|
|
}
|
|
|
|
return this.item.id
|
|
|
|
},
|
|
|
|
avatarUrl() {
|
2020-10-09 16:16:40 +00:00
|
|
|
return generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.id)
|
2018-12-03 09:02:46 +00:00
|
|
|
}
|
2018-10-26 11:08:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
.user-avatar {
|
|
|
|
margin: 5px;
|
|
|
|
margin-right: 10px;
|
|
|
|
border-radius: 50%;
|
|
|
|
flex-shrink: 0;
|
|
|
|
}
|
|
|
|
|
2018-12-04 19:43:32 +00:00
|
|
|
.post-author {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
2018-10-26 11:08:46 +00:00
|
|
|
.entry-content {
|
|
|
|
display: flex;
|
|
|
|
align-items: flex-start;
|
|
|
|
}
|
|
|
|
|
|
|
|
.user-details {
|
|
|
|
flex-grow: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.user-description {
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
2018-12-03 07:10:43 +00:00
|
|
|
|
|
|
|
button {
|
2019-08-22 08:06:02 +00:00
|
|
|
margin-left: 10px;
|
2018-12-03 07:10:43 +00:00
|
|
|
min-width: 110px;
|
|
|
|
}
|
|
|
|
|
|
|
|
button * {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2018-10-26 11:08:46 +00:00
|
|
|
</style>
|