Merge pull request #1673 from nextcloud/artonge/feat/use_visibility_of_parent_for_reply

Use visibility of parent message when composing a reply
pull/1675/head
Maxence Lange 2023-03-17 09:37:22 -01:00 zatwierdzone przez GitHub
commit f734f0ba16
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 21 dodań i 56 usunięć

Wyświetl plik

@ -106,9 +106,9 @@
</NcEmojiPicker> </NcEmojiPicker>
</div> </div>
<VisibilitySelect :type.sync="type" /> <VisibilitySelect :visibility.sync="visibility" />
<div class="emptySpace" /> <div class="emptySpace" />
<SubmitStatusButton :type="type" :disabled="!canPost || loading" @click="createPost" /> <SubmitStatusButton :visibility="visibility" :disabled="!canPost || loading" @click="createPost" />
<!-- <NcButton :value="currentVisibilityPostLabel" <!-- <NcButton :value="currentVisibilityPostLabel"
:disabled="!canPost" :disabled="!canPost"
@ -175,7 +175,7 @@ export default {
data() { data() {
return { return {
statusContent: '', statusContent: '',
type: localStorage.getItem('social.lastPostType') || 'followers', visibility: localStorage.getItem('social.lastPostType') || 'followers',
loading: false, loading: false,
/** @type {Object<string, LocalAttachment>} */ /** @type {Object<string, LocalAttachment>} */
attachments: {}, attachments: {},
@ -274,7 +274,7 @@ export default {
mounted() { mounted() {
this.$root.$on('composer-reply', (data) => { this.$root.$on('composer-reply', (data) => {
this.replyTo = data this.replyTo = data
this.type = 'direct' this.visibility = data.visibility
}) })
}, },
methods: { methods: {
@ -364,7 +364,7 @@ export default {
spoiler_text: '', spoiler_text: '',
status, status,
in_reply_to_id: this.replyTo?.id, in_reply_to_id: this.replyTo?.id,
visibility: this.type, visibility: this.visibility,
} }
console.debug('[Composer] Posting status', statusData) console.debug('[Composer] Posting status', statusData)

Wyświetl plik

@ -46,7 +46,7 @@ export default {
Send, Send,
}, },
props: { props: {
type: { visibility: {
type: String, type: String,
required: true, required: true,
}, },
@ -58,7 +58,7 @@ export default {
computed: { computed: {
/** @return {string} */ /** @return {string} */
postTo() { postTo() {
switch (this.type) { switch (this.visibility) {
case 'public': case 'public':
case 'unlisted': case 'unlisted':
return t('social', 'Post') return t('social', 'Post')
@ -71,15 +71,15 @@ export default {
}, },
/** @return {string} */ /** @return {string} */
currentVisibilityPostLabel() { currentVisibilityPostLabel() {
return this.visibilityPostLabel(this.type) return this.visibilityPostLabel(this.visibility)
}, },
/** @return {Function} */ /** @return {Function} */
visibilityPostLabel() { visibilityPostLabel() {
return (type) => { return (visibility) => {
if (typeof type === 'undefined') { if (visibility === undefined) {
type = this.type visibility = this.visibility
} }
switch (type) { switch (visibility) {
case 'public': case 'public':
return t('social', 'Post publicly') return t('social', 'Post publicly')
case 'followers': case 'followers':
@ -100,38 +100,3 @@ export default {
} }
</script> </script>
<style scoped lang="scss">
.new-post {
padding: 10px;
background-color: var(--color-main-background);
position: sticky;
z-index: 100;
margin-bottom: 10px;
top: 0;
&-form {
flex-grow: 1;
position: relative;
top: -10px;
margin-left: 39px;
&__emoji-picker {
z-index: 1;
}
}
}
input[type=submit].inline {
width: 44px;
height: 44px;
margin: 0;
padding: 13px;
background-color: transparent;
border: none;
opacity: 0.3;
position: absolute;
bottom: 0;
right: 0;
}
</style>

Wyświetl plik

@ -44,7 +44,7 @@ export default {
NcButton, NcButton,
}, },
props: { props: {
type: { visibility: {
type: String, type: String,
required: true, required: true,
}, },
@ -64,7 +64,7 @@ export default {
computed: { computed: {
/** @return {string} */ /** @return {string} */
currentVisibilityIconClass() { currentVisibilityIconClass() {
return this.typeToClass[this.type] return this.typeToClass[this.visibility]
}, },
/** @return {Array} */ /** @return {Array} */
visibilityPopover() { visibilityPopover() {
@ -72,28 +72,28 @@ export default {
{ {
action: () => this.switchType('public'), action: () => this.switchType('public'),
icon: this.typeToClass.public, icon: this.typeToClass.public,
active: this.type === 'public', active: this.visibility === 'public',
text: t('social', 'Public'), text: t('social', 'Public'),
longtext: t('social', 'Post to public timelines'), longtext: t('social', 'Post to public timelines'),
}, },
{ {
action: () => this.switchType('unlisted'), action: () => this.switchType('unlisted'),
icon: this.typeToClass.unlisted, icon: this.typeToClass.unlisted,
active: this.type === 'unlisted', active: this.visibility === 'unlisted',
text: t('social', 'Unlisted'), text: t('social', 'Unlisted'),
longtext: t('social', 'Do not post to public timelines'), longtext: t('social', 'Do not post to public timelines'),
}, },
{ {
action: () => this.switchType('followers'), action: () => this.switchType('followers'),
icon: this.typeToClass.followers, icon: this.typeToClass.followers,
active: this.type === 'followers', active: this.visibility === 'followers',
text: t('social', 'Followers'), text: t('social', 'Followers'),
longtext: t('social', 'Post to followers only'), longtext: t('social', 'Post to followers only'),
}, },
{ {
action: () => this.switchType('direct'), action: () => this.switchType('direct'),
icon: this.typeToClass.direct, icon: this.typeToClass.direct,
active: this.type === 'direct', active: this.visibility === 'direct',
text: t('social', 'Direct'), text: t('social', 'Direct'),
longtext: t('social', 'Post to mentioned users only'), longtext: t('social', 'Post to mentioned users only'),
}, },
@ -109,10 +109,10 @@ export default {
this.menuOpened = false this.menuOpened = false
}, },
switchType(type) { switchType(visibility) {
this.$emit('update:type', type) this.$emit('update:visibility', visibility)
this.menuOpened = false this.menuOpened = false
localStorage.setItem('social.lastPostType', type) localStorage.setItem('social.lastPostType', visibility)
}, },
t: translate, t: translate,