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-if="safeDMEnabled">{{ $t('post_status.direct_warning_to_first_only') }}</span>
<span v-else>{{ $t('post_status.direct_warning_to_all') }}</span> <span v-else>{{ $t('post_status.direct_warning_to_all') }}</span>
</p> </p>
<EmojiInput
v-if="newStatus.spoilerText || alwaysShowSubject"
v-model="newStatus.spoilerText"
:suggest="emojiSuggestor"
class="form-control"
>
<input
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> </EmojiInput>
<div class="visibility-tray"> <div class="visibility-tray">
<div <scope-selector
v-if="postFormats.length > 1" :showAll="showAllScopes"
class="text-format" :userDefault="userDefaultScope"
> :originalScope="copyMessageScope"
<label :initialScope="newStatus.visibility"
for="post-content-type" :onScopeChange="changeVis"/>
class="select"
> <div class="text-format" v-if="postFormats.length > 1">
<select <label for="post-content-type" class="select">
id="post-content-type" <select id="post-content-type" v-model="newStatus.contentType" class="form-control">
v-model="newStatus.contentType" <option v-for="postFormat in postFormats" :key="postFormat" :value="postFormat">
class="form-control"
>
<option
v-for="postFormat in postFormats"
:key="postFormat"
:value="postFormat"
>
{{$t(`post_status.content_type["${postFormat}"]`)}} {{$t(`post_status.content_type["${postFormat}"]`)}}
</option> </option>
</select> </select>
<i class="icon-down-open" /> <i class="icon-down-open"></i>
</label> </label>
</div> </div>
<div <div class="text-format" v-if="postFormats.length === 1 && postFormats[0] !== 'text/plain'">
v-if="postFormats.length === 1"
class="text-format"
>
<span class="only-format"> <span class="only-format">
{{$t(`post_status.content_type["${postFormats[0]}"]`)}} {{$t(`post_status.content_type["${postFormats[0]}"]`)}}
</span> </span>
</div> </div>
<scope-selector
:show-all="showAllScopes"
:user-default="userDefaultScope"
:original-scope="copyMessageScope"
:initial-scope="newStatus.visibility"
:on-scope-change="changeVis"
/>
</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>
<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>
<div class="attachments"> <div class="attachments">
<div <div
@ -276,7 +156,6 @@
.visibility-tray { .visibility-tray {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-direction: row-reverse;
padding-top: 5px; padding-top: 5px;
} }
} }
@ -324,6 +203,7 @@
cursor: pointer; cursor: pointer;
} }
.error { .error {
text-align: center; text-align: center;
} }

View file

@ -86,7 +86,7 @@ const Timeline = {
if (this.newStatusCount === 0) return if (this.newStatusCount === 0) return
if (this.timeline.flushMarker !== 0) { 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.$store.commit('queueFlush', { timeline: this.timelineName, id: 0 })
this.fetchOlderStatuses() this.fetchOlderStatuses()
} else { } else {

View file

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

View file

@ -78,6 +78,20 @@
"repeated_you": "a repetit vòstre estatut", "repeated_you": "a repetit vòstre estatut",
"no_more_notifications": "Pas mai de notificacions" "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": { "post_status": {
"new_status": "Publicar destatuts novèls", "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.", "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": "Bocla vidèo",
"loop_video_silent_only": "Legir en bocla solament las vidèos sens son (coma los « Gifs » de Mastodon)", "loop_video_silent_only": "Legir en bocla solament las vidèos sens son (coma los « Gifs » de Mastodon)",
"mutes_tab": "Agamats", "mutes_tab": "Agamats",
"interactions_tab": "Interaccions",
"play_videos_in_modal": "Legir las vidèos dirèctament dins la visualizaira mèdia", "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", "use_contain_fit": "Talhar pas las pèças juntas per las vinhetas",
"name": "Nom", "name": "Nom",
@ -265,6 +280,13 @@
"true": "òc" "true": "òc"
}, },
"notifications": "Notificacions", "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", "enable_web_push_notifications": "Activar las notificacions web push",
"style": { "style": {
"switcher": { "switcher": {
@ -386,14 +408,14 @@
"days": "{0} jorns", "days": "{0} jorns",
"day_short": "{0} jorn", "day_short": "{0} jorn",
"days_short": "{0} jorns", "days_short": "{0} jorns",
"hour": "{0} hour", "hour": "{0} ora",
"hours": "{0} hours", "hours": "{0} oras",
"hour_short": "{0}h", "hour_short": "{0}h",
"hours_short": "{0}h", "hours_short": "{0}h",
"in_future": "in {0}", "in_future": "daquí {0}",
"in_past": "fa {0}", "in_past": "fa {0}",
"minute": "{0} minute", "minute": "{0} minuta",
"minutes": "{0} minutes", "minutes": "{0} minutas",
"minute_short": "{0}min", "minute_short": "{0}min",
"minutes_short": "{0}min", "minutes_short": "{0}min",
"month": "{0} mes", "month": "{0} mes",
@ -402,12 +424,12 @@
"months_short": "{0} meses", "months_short": "{0} meses",
"now": "ara meteis", "now": "ara meteis",
"now_short": "ara meteis", "now_short": "ara meteis",
"second": "{0} second", "second": "{0} segonda",
"seconds": "{0} seconds", "seconds": "{0} segondas",
"second_short": "{0}s", "second_short": "{0}s",
"seconds_short": "{0}s", "seconds_short": "{0}s",
"week": "{0} setm.", "week": "{0} setmana.",
"weeks": "{0} setm.", "weeks": "{0} setmanas.",
"week_short": "{0} setm.", "week_short": "{0} setm.",
"weeks_short": "{0} setm.", "weeks_short": "{0} setm.",
"year": "{0} an", "year": "{0} an",

View file

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

View file

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