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-11-27 16:43:28 +00:00
|
|
|
<avatar v-if="item.local" :size="32" :user="item.preferredUsername" />
|
2018-11-29 10:51:22 +00:00
|
|
|
<avatar v-else :url="item.icon.url" />
|
2018-10-26 11:08:46 +00:00
|
|
|
</div>
|
|
|
|
<div class="user-details">
|
2018-11-28 15:44:49 +00:00
|
|
|
<router-link v-if="item.local" :to="{ name: 'profile', params: { account: item.account }}">
|
2018-11-27 09:24:16 +00:00
|
|
|
<span class="post-author">{{ item.preferredUsername }}</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"
|
2018-11-29 10:51:22 +00:00
|
|
|
rel="noreferrer">{{ item.name }} <span class="user-description">{{ item.account }}</span></a>
|
|
|
|
<!-- TODO check where the html is coming from to avoid security issues -->
|
|
|
|
<p v-html="item.summary" />
|
2018-10-26 11:08:46 +00:00
|
|
|
</div>
|
2018-12-03 07:10:43 +00:00
|
|
|
<button v-if="item.details.following" :class="{'icon-loading-small': followLoading}"
|
|
|
|
@click="unfollow()"
|
|
|
|
@mouseover="followingText=t('social', 'Unfollow')" @mouseleave="followingText=t('social', 'Following')">
|
|
|
|
<span><span class="icon-checkmark" />{{ followingText }}</span></button>
|
|
|
|
<button v-else :class="{'icon-loading-small': followLoading}" class="primary"
|
|
|
|
@click="follow"><span>{{ t('social', 'Follow') }}</span></button>
|
2018-10-26 11:08:46 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { Avatar } from 'nextcloud-vue'
|
2018-11-29 10:51:22 +00:00
|
|
|
import follow from '../mixins/follow'
|
2018-10-26 11:08:46 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'UserEntry',
|
|
|
|
components: {
|
|
|
|
Avatar
|
|
|
|
},
|
2018-11-29 10:51:22 +00:00
|
|
|
mixins: [
|
|
|
|
follow
|
|
|
|
],
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
.user-entry {
|
2018-11-12 18:58:11 +00:00
|
|
|
padding: 20px;
|
2018-10-26 11:08:46 +00:00
|
|
|
margin-bottom: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.user-avatar {
|
|
|
|
margin: 5px;
|
|
|
|
margin-right: 10px;
|
|
|
|
border-radius: 50%;
|
|
|
|
flex-shrink: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.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 {
|
|
|
|
min-width: 110px;
|
|
|
|
}
|
|
|
|
|
|
|
|
button * {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2018-10-26 11:08:46 +00:00
|
|
|
</style>
|