separate reply button to its own component, add changelog entry

This commit is contained in:
Shpuld Shpuldson 2020-09-07 10:35:49 +03:00
parent 40ca0b394e
commit f9ac23b9a9
5 changed files with 48 additions and 27 deletions

View file

@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased] ## [Unreleased]
## [Unreleased patch] ## [Unreleased patch]
### Added
- Proper handling of deletes when using websocket streaming
### Changed ### Changed
- Polls will be hidden with status content if "Collapse posts with subjects" is enabled and the post is collapsed. - Polls will be hidden with status content if "Collapse posts with subjects" is enabled and the post is collapsed.

View file

@ -0,0 +1,12 @@
const ReplyButton = {
name: 'ReplyButton',
props: ['status', 'replying'],
computed: {
loggedIn () {
return !!this.$store.state.users.currentUser
}
}
}
export default ReplyButton

View file

@ -0,0 +1,21 @@
<template>
<div>
<i
v-if="loggedIn"
class="button-icon button-reply icon-reply"
:title="$t('tool_tip.reply')"
:class="{'-active': replying}"
@click.prevent="$emit('toggle')"
/>
<i
v-else
class="button-icon button-reply -disabled icon-reply"
:title="$t('tool_tip.reply')"
/>
<span v-if="status.replies_count > 0">
{{ status.replies_count }}
</span>
</div>
</template>
<script src="./reply_button.js"></script>

View file

@ -1,3 +1,4 @@
import ReplyButton from '../reply_button/reply_button.vue'
import FavoriteButton from '../favorite_button/favorite_button.vue' import FavoriteButton from '../favorite_button/favorite_button.vue'
import ReactButton from '../react_button/react_button.vue' import ReactButton from '../react_button/react_button.vue'
import RetweetButton from '../retweet_button/retweet_button.vue' import RetweetButton from '../retweet_button/retweet_button.vue'
@ -20,6 +21,7 @@ import { mapGetters, mapState } from 'vuex'
const Status = { const Status = {
name: 'Status', name: 'Status',
components: { components: {
ReplyButton,
FavoriteButton, FavoriteButton,
ReactButton, ReactButton,
RetweetButton, RetweetButton,

View file

@ -321,21 +321,11 @@
v-if="!noHeading && !isPreview" v-if="!noHeading && !isPreview"
class="status-actions" class="status-actions"
> >
<div> <reply-button
<i :replying="replying"
v-if="loggedIn" :status="status"
class="button-icon button-reply icon-reply" @toggle="toggleReplying"
:title="$t('tool_tip.reply')" />
:class="{'-active': replying}"
@click.prevent="toggleReplying"
/>
<i
v-else
class="button-icon button-reply -disabled icon-reply"
:title="$t('tool_tip.reply')"
/>
<span v-if="status.replies_count > 0">{{ status.replies_count }}</span>
</div>
<retweet-button <retweet-button
:visibility="status.visibility" :visibility="status.visibility"
:logged-in="loggedIn" :logged-in="loggedIn"
@ -368,18 +358,11 @@
<div class="deleted-text"> <div class="deleted-text">
{{ $t('status.status_deleted') }} {{ $t('status.status_deleted') }}
</div> </div>
<div <reply-button
v-if="replying" :replying="replying"
class="status-actions" :status="status"
> @toggle="toggleReplying"
<i />
v-if="loggedIn"
class="button-icon button-reply icon-reply"
:title="$t('tool_tip.reply')"
:class="{'-active': replying}"
@click.prevent="toggleReplying"
/>
</div>
</div> </div>
</div> </div>
<div <div