Merge branch 'develop' into 'eslint-fix'

# Conflicts:
#   src/components/post_status_form/post_status_form.vue
This commit is contained in:
HJ 2019-07-06 20:43:38 +00:00
commit 8f53796420
6 changed files with 63 additions and 158 deletions

View file

@ -58,150 +58,30 @@
<span v-if="safeDMEnabled">{{ $t('post_status.direct_warning_to_first_only') }}</span>
<span v-else>{{ $t('post_status.direct_warning_to_all') }}</span>
</p>
<EmojiInput
v-if="newStatus.spoilerText || alwaysShowSubject"
v-model="newStatus.spoilerText"
:suggest="emojiSuggestor"
class="form-control"
>
<input
</EmojiInput>
<div class="visibility-tray">
<scope-selector
:showAll="showAllScopes"
:userDefault="userDefaultScope"
:originalScope="copyMessageScope"
:initialScope="newStatus.visibility"
:onScopeChange="changeVis"/>
v-model="newStatus.spoilerText"
type="text"
:placeholder="$t('post_status.content_warning')"
class="form-post-subject"
>
</EmojiInput>
<EmojiInput
v-model="newStatus.status"
:suggest="emojiUserSuggestor"
class="form-control main-input"
>
<textarea
ref="textarea"
v-model="newStatus.status"
:placeholder="$t('post_status.default')"
rows="1"
:disabled="posting"
class="form-post-body"
@keydown.meta.enter="postStatus(newStatus)"
@keyup.ctrl.enter="postStatus(newStatus)"
@drop="fileDrop"
@dragover.prevent="fileDrag"
@input="resize"
@paste="paste"
/>
<p
v-if="hasStatusLengthLimit"
class="character-counter faint"
:class="{ error: isOverLengthLimit }"
>
{{ charactersLeft }}
</p>
</EmojiInput>
<div class="visibility-tray">
<div
v-if="postFormats.length > 1"
class="text-format"
>
<label
for="post-content-type"
class="select"
>
<select
id="post-content-type"
v-model="newStatus.contentType"
class="form-control"
>
<option
v-for="postFormat in postFormats"
:key="postFormat"
:value="postFormat"
>
{{ $t(`post_status.content_type["${postFormat}"]`) }}
</option>
</select>
<i class="icon-down-open" />
</label>
</div>
<div
v-if="postFormats.length === 1"
class="text-format"
>
<span class="only-format">
{{ $t(`post_status.content_type["${postFormats[0]}"]`) }}
</span>
</div>
<scope-selector
:show-all="showAllScopes"
:user-default="userDefaultScope"
:original-scope="copyMessageScope"
:initial-scope="newStatus.visibility"
:on-scope-change="changeVis"
/>
<div class="text-format" v-if="postFormats.length > 1">
<label for="post-content-type" class="select">
<select id="post-content-type" v-model="newStatus.contentType" class="form-control">
<option v-for="postFormat in postFormats" :key="postFormat" :value="postFormat">
{{$t(`post_status.content_type["${postFormat}"]`)}}
</option>
</select>
<i class="icon-down-open"></i>
</label>
</div>
</div>
<poll-form
v-if="pollsAvailable"
ref="pollForm"
:visible="pollFormVisible"
@update-poll="setPoll"
/>
<div class="form-bottom">
<div class="form-bottom-left">
<media-upload
ref="mediaUpload"
:drop-files="dropFiles"
@uploading="disableSubmit"
@uploaded="addMediaFile"
@upload-failed="uploadFailed"
/>
<div
v-if="pollsAvailable"
class="poll-icon"
>
<i
:title="$t('polls.add_poll')"
class="icon-chart-bar btn btn-default"
:class="pollFormVisible && 'selected'"
@click="togglePollForm"
/>
</div>
<div class="text-format" v-if="postFormats.length === 1 && postFormats[0] !== 'text/plain'">
<span class="only-format">
{{$t(`post_status.content_type["${postFormats[0]}"]`)}}
</span>
</div>
<button
v-if="posting"
disabled
class="btn btn-default"
>
{{ $t('post_status.posting') }}
</button>
<button
v-else-if="isOverLengthLimit"
disabled
class="btn btn-default"
>
{{ $t('general.submit') }}
</button>
<button
v-else
:disabled="submitDisabled"
type="submit"
class="btn btn-default"
>
{{ $t('general.submit') }}
</button>
</div>
<div
v-if="error"
class="alert error"
>
Error: {{ error }}
<i
class="button-icon icon-cancel"
@click="clearError"
/>
</div>
<div class="attachments">
<div
@ -276,7 +156,6 @@
.visibility-tray {
display: flex;
justify-content: space-between;
flex-direction: row-reverse;
padding-top: 5px;
}
}
@ -324,6 +203,7 @@
cursor: pointer;
}
.error {
text-align: center;
}

View file

@ -86,7 +86,7 @@ const Timeline = {
if (this.newStatusCount === 0) return
if (this.timeline.flushMarker !== 0) {
this.$store.commit('clearTimeline', { timeline: this.timelineName })
this.$store.commit('clearTimeline', { timeline: this.timelineName, excludeUserId: true })
this.$store.commit('queueFlush', { timeline: this.timelineName, id: 0 })
this.fetchOlderStatuses()
} else {

View file

@ -31,6 +31,8 @@ const UserProfile = {
}
},
created () {
// Make sure that timelines used in this page are empty
this.cleanUp()
const routeParams = this.$route.params
this.load(routeParams.name || routeParams.id)
},

View file

@ -78,6 +78,20 @@
"repeated_you": "a repetit vòstre estatut",
"no_more_notifications": "Pas mai de notificacions"
},
"polls": {
"add_poll": "Ajustar un sondatge",
"add_option": "Ajustar dopcions",
"option": "Opcion",
"votes": "vòtes",
"vote": "Votar",
"type": "Tipe de sondatge",
"single_choice": "Causida unica",
"multiple_choices": "Causida multipla",
"expiry": "Durada del sondatge",
"expires_in": "Lo sondatge sacabarà {0}",
"expired": "Sondatge acabat {0}",
"not_enough_options": "I a pas pro dopcions"
},
"post_status": {
"new_status": "Publicar destatuts novèls",
"account_not_locked_warning": "Vòstre compte es pas {0}. Qual que siá pòt vos seguir per veire vòstras publicacions destinadas pas qua vòstres seguidors.",
@ -197,6 +211,7 @@
"loop_video": "Bocla vidèo",
"loop_video_silent_only": "Legir en bocla solament las vidèos sens son (coma los « Gifs » de Mastodon)",
"mutes_tab": "Agamats",
"interactions_tab": "Interaccions",
"play_videos_in_modal": "Legir las vidèos dirèctament dins la visualizaira mèdia",
"use_contain_fit": "Talhar pas las pèças juntas per las vinhetas",
"name": "Nom",
@ -264,8 +279,15 @@
"false": "non",
"true": "òc"
},
"notifications": "Notificacions",
"enable_web_push_notifications": "Activar las notificacions web push",
"notifications": "Notificacions",
"notification_setting": "Receber las notificacions de:",
"notification_setting_follows": "Utilizaires que seguissètz",
"notification_setting_non_follows": "Utilizaires que seguissètz pas",
"notification_setting_followers": "Utilizaires que vos seguisson",
"notification_setting_non_followers": "Utilizaires que vos seguisson pas",
"notification_mutes": "Per receber pas mai dun utilizaire en particular, botatz-lo en silenci.",
"notification_blocks": "Blocar un utilizaire arrèsta totas las notificacions tan coma quitar de los seguir.",
"enable_web_push_notifications": "Activar las notificacions web push",
"style": {
"switcher": {
"keep_color": "Gardar las colors",
@ -386,14 +408,14 @@
"days": "{0} jorns",
"day_short": "{0} jorn",
"days_short": "{0} jorns",
"hour": "{0} hour",
"hours": "{0} hours",
"hour": "{0} ora",
"hours": "{0} oras",
"hour_short": "{0}h",
"hours_short": "{0}h",
"in_future": "in {0}",
"in_future": "daquí {0}",
"in_past": "fa {0}",
"minute": "{0} minute",
"minutes": "{0} minutes",
"minute": "{0} minuta",
"minutes": "{0} minutas",
"minute_short": "{0}min",
"minutes_short": "{0}min",
"month": "{0} mes",
@ -402,12 +424,12 @@
"months_short": "{0} meses",
"now": "ara meteis",
"now_short": "ara meteis",
"second": "{0} second",
"seconds": "{0} seconds",
"second": "{0} segonda",
"seconds": "{0} segondas",
"second_short": "{0}s",
"seconds_short": "{0}s",
"week": "{0} setm.",
"weeks": "{0} setm.",
"week": "{0} setmana.",
"weeks": "{0} setmanas.",
"week_short": "{0} setm.",
"weeks_short": "{0} setm.",
"year": "{0} an",

View file

@ -395,8 +395,9 @@ export const mutations = {
state[key] = value
})
},
clearTimeline (state, { timeline }) {
state.timelines[timeline] = emptyTl(state.timelines[timeline].userId)
clearTimeline (state, { timeline, excludeUserId = false }) {
const userId = excludeUserId ? state.timelines[timeline].userId : undefined
state.timelines[timeline] = emptyTl(userId)
},
clearNotifications (state) {
state.notifications = emptyNotifications()

View file

@ -258,11 +258,11 @@ describe('Statuses module', () => {
})
describe('clearTimeline', () => {
it('keeps userId when clearing user timeline', () => {
it('keeps userId when clearing user timeline when excludeUserId param is true', () => {
const state = defaultState()
state.timelines.user.userId = 123
mutations.clearTimeline(state, { timeline: 'user' })
mutations.clearTimeline(state, { timeline: 'user', excludeUserId: true })
expect(state.timelines.user.userId).to.eql(123)
})