Merge branch 'develop' into feature/replace-panel-switcher

This commit is contained in:
shpuld 2018-12-22 17:32:35 +02:00
commit f72b1d048e
15 changed files with 40 additions and 64 deletions

View file

@ -33,10 +33,7 @@
</router-link> </router-link>
</div> </div>
<template v-else> <template v-else>
<status :activatePanel="activatePanel" v-if="notification.status" class="faint" :compact="true" :statusoid="notification.status" :noHeading="true"></status> <status :activatePanel="activatePanel" class="faint" :compact="true" :statusoid="notification.status" :noHeading="true"></status>
<div class="broken-favorite" v-else>
{{$t('notifications.broken_favorite')}}
</div>
</template> </template>
</div> </div>
</div> </div>

View file

@ -36,16 +36,6 @@
border-color: $fallback--border; border-color: $fallback--border;
border-color: var(--border, $fallback--border); border-color: var(--border, $fallback--border);
.broken-favorite {
border-radius: $fallback--tooltipRadius;
border-radius: var(--tooltipRadius, $fallback--tooltipRadius);
color: $fallback--text;
color: var(--alertErrorText, $fallback--text);
background-color: $fallback--alertError;
background-color: var(--alertError, $fallback--alertError);
padding: 2px .5em
}
.avatar-compact { .avatar-compact {
width: 32px; width: 32px;
height: 32px; height: 32px;

View file

@ -41,12 +41,16 @@ const PostStatusForm = {
const preset = this.$route.query.message const preset = this.$route.query.message
let statusText = preset || '' let statusText = preset || ''
const scopeCopy = typeof this.$store.state.config.scopeCopy === 'undefined'
? this.$store.state.instance.scopeCopy
: this.$store.state.config.scopeCopy
if (this.replyTo) { if (this.replyTo) {
const currentUser = this.$store.state.users.currentUser const currentUser = this.$store.state.users.currentUser
statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser) statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser)
} }
const scope = (this.copyMessageScope && this.$store.state.config.scopeCopy || this.copyMessageScope === 'direct') const scope = (this.copyMessageScope && scopeCopy || this.copyMessageScope === 'direct')
? this.copyMessageScope ? this.copyMessageScope
: this.$store.state.users.currentUser.default_scope : this.$store.state.users.currentUser.default_scope

View file

@ -48,8 +48,10 @@ const registration = {
async submit () { async submit () {
this.user.nickname = this.user.username this.user.nickname = this.user.username
this.user.token = this.token this.user.token = this.token
this.user.captcha_solution = this.captcha.solution this.user.captcha_solution = this.captcha.solution
this.user.captcha_token = this.captcha.token this.user.captcha_token = this.captcha.token
this.user.captcha_answer_data = this.captcha.answer_data
this.$v.$touch() this.$v.$touch()

View file

@ -76,15 +76,16 @@
</div> </div>
<div class="form-group" id="captcha-group" v-if="captcha.type != 'none'"> <div class="form-group" id="captcha-group" v-if="captcha.type != 'none'">
<label class='form--label' for='captcha-label'>$t('captcha')</label>
<template v-if="captcha.type == 'kocaptcha'"> <template v-if="captcha.type == 'kocaptcha'">
<img v-bind:src="captcha.url" v-on:click="setCaptcha"> <img v-bind:src="captcha.url" v-on:click="setCaptcha">
<sub>Click the image to get a new captcha</sub> <sub>{{$t('registration.new_captcha')}}</sub>
<label class='form--label' for='captcha-label'>CAPTCHA</label>
<input :disabled="isPending" <input :disabled="isPending"
v-model='captcha.solution' v-model='captcha.solution'
class='form-control' id='captcha-answer' type='text'> class='form-control' id='captcha-answer' type='text' autocomplete="off">
</template> </template>
</div> </div>

View file

@ -15,14 +15,17 @@ const settings = {
hideNsfwLocal: user.hideNsfw, hideNsfwLocal: user.hideNsfw,
hideISPLocal: user.hideISP, hideISPLocal: user.hideISP,
preloadImage: user.preloadImage, preloadImage: user.preloadImage,
hidePostStatsLocal: typeof user.hidePostStats === 'undefined' hidePostStatsLocal: typeof user.hidePostStats === 'undefined'
? instance.hidePostStats ? instance.hidePostStats
: user.hidePostStats, : user.hidePostStats,
hidePostStatsDefault: this.$t('settings.values.' + instance.hidePostStats), hidePostStatsDefault: this.$t('settings.values.' + instance.hidePostStats),
hideUserStatsLocal: typeof user.hideUserStats === 'undefined' hideUserStatsLocal: typeof user.hideUserStats === 'undefined'
? instance.hideUserStats ? instance.hideUserStats
: user.hideUserStats, : user.hideUserStats,
hideUserStatsDefault: this.$t('settings.values.' + instance.hideUserStats), hideUserStatsDefault: this.$t('settings.values.' + instance.hideUserStats),
notificationVisibilityLocal: user.notificationVisibility, notificationVisibilityLocal: user.notificationVisibility,
replyVisibilityLocal: user.replyVisibility, replyVisibilityLocal: user.replyVisibility,
loopVideoLocal: user.loopVideo, loopVideoLocal: user.loopVideo,
@ -32,20 +35,27 @@ const settings = {
streamingLocal: user.streaming, streamingLocal: user.streaming,
pauseOnUnfocusedLocal: user.pauseOnUnfocused, pauseOnUnfocusedLocal: user.pauseOnUnfocused,
hoverPreviewLocal: user.hoverPreview, hoverPreviewLocal: user.hoverPreview,
collapseMessageWithSubjectLocal: typeof user.collapseMessageWithSubject === 'undefined' collapseMessageWithSubjectLocal: typeof user.collapseMessageWithSubject === 'undefined'
? instance.collapseMessageWithSubject ? instance.collapseMessageWithSubject
: user.collapseMessageWithSubject, : user.collapseMessageWithSubject,
collapseMessageWithSubjectDefault: this.$t('settings.values.' + instance.collapseMessageWithSubject), collapseMessageWithSubjectDefault: this.$t('settings.values.' + instance.collapseMessageWithSubject),
subjectLineBehaviorLocal: typeof user.subjectLineBehavior === 'undefined' subjectLineBehaviorLocal: typeof user.subjectLineBehavior === 'undefined'
? instance.subjectLineBehavior ? instance.subjectLineBehavior
: user.subjectLineBehavior, : user.subjectLineBehavior,
subjectLineBehaviorDefault: instance.subjectLineBehavior, subjectLineBehaviorDefault: instance.subjectLineBehavior,
alwaysShowSubjectInputLocal: typeof user.alwaysShowSubjectInput === 'undefined' alwaysShowSubjectInputLocal: typeof user.alwaysShowSubjectInput === 'undefined'
? instance.alwaysShowSubjectInput ? instance.alwaysShowSubjectInput
: user.alwaysShowSubjectInput, : user.alwaysShowSubjectInput,
alwaysShowSubjectInputDefault: instance.alwaysShowSubjectInput, alwaysShowSubjectInputDefault: instance.alwaysShowSubjectInput,
scopeCopyLocal: user.scopeCopy,
scopeCopyLocal: typeof user.scopeCopy === 'undefined'
? instance.scopeCopy
: user.scopeCopy,
scopeCopyDefault: this.$t('settings.values.' + instance.scopeCopy), scopeCopyDefault: this.$t('settings.values.' + instance.scopeCopy),
stopGifs: user.stopGifs, stopGifs: user.stopGifs,
webPushNotificationsLocal: user.webPushNotifications, webPushNotificationsLocal: user.webPushNotifications,
loopSilentAvailable: loopSilentAvailable:

View file

@ -188,7 +188,9 @@ const Status = {
}, },
replySubject () { replySubject () {
if (!this.status.summary) return '' if (!this.status.summary) return ''
const behavior = this.$store.state.config.subjectLineBehavior const behavior = typeof this.$store.state.config.subjectLineBehavior === 'undefined'
? this.$store.state.instance.subjectLineBehavior
: this.$store.state.config.subjectLineBehavior
const startsWithRe = this.status.summary.match(/^re[: ]/i) const startsWithRe = this.status.summary.match(/^re[: ]/i)
if (behavior !== 'noop' && startsWithRe || behavior === 'masto') { if (behavior !== 'noop' && startsWithRe || behavior === 'masto') {
return this.status.summary return this.status.summary

View file

@ -18,18 +18,24 @@ const UserProfile = {
return this.$store.state.statuses.timelines.user return this.$store.state.statuses.timelines.user
}, },
userId () { userId () {
return this.$route.params.id return this.$route.params.id || this.user.id
}, },
userName () { userName () {
return this.$route.params.name return this.$route.params.name
}, },
friends () {
return this.user.friends
},
followers () {
return this.user.followers
},
user () { user () {
if (this.timeline.statuses[0]) { if (this.timeline.statuses[0]) {
return this.timeline.statuses[0].user return this.timeline.statuses[0].user
} else { } else {
return Object.values(this.$store.state.users.usersObject).filter(user => { return Object.values(this.$store.state.users.usersObject).filter(user => {
return (this.isExternal ? user.id === this.userId : user.screen_name === this.userName) return (this.isExternal ? user.id === this.userId : user.screen_name === this.userName)
})[0] || false })[0] || {}
} }
}, },
fetchBy () { fetchBy () {
@ -67,7 +73,7 @@ const UserProfile = {
this.$store.dispatch('startFetching', ['user', this.userId]) this.$store.dispatch('startFetching', ['user', this.userId])
}, },
user () { user () {
if (!this.user.followers) { if (this.user.id && !this.user.followers) {
this.fetchFollowers() this.fetchFollowers()
this.fetchFriends() this.fetchFriends()
} }

View file

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<div v-if="user" class="user-profile panel panel-default"> <div v-if="user.id" class="user-profile panel panel-default">
<user-card-content :user="user" :switcher="true" :selected="timeline.viewing"></user-card-content> <user-card-content :user="user" :switcher="true" :selected="timeline.viewing"></user-card-content>
<tab-switcher> <tab-switcher>
<Timeline :label="$t('user_card.statuses')" :embedded="true" :title="$t('user_profile.timeline_title')" :timeline="timeline" :timeline-name="'user'" :user-id="userId"/> <Timeline :label="$t('user_card.statuses')" :embedded="true" :title="$t('user_profile.timeline_title')" :timeline="timeline" :timeline-name="'user'" :user-id="userId"/>

View file

@ -75,6 +75,8 @@
"password_confirm": "Password confirmation", "password_confirm": "Password confirmation",
"registration": "Registration", "registration": "Registration",
"token": "Invite token", "token": "Invite token",
"captcha": "CAPTCHA",
"new_captcha": "Click the image to get a new captcha",
"validations": { "validations": {
"username_required": "cannot be left blank", "username_required": "cannot be left blank",
"fullname_required": "cannot be left blank", "fullname_required": "cannot be left blank",

View file

@ -46,9 +46,6 @@ const api = {
store.commit('addFetcher', {timeline, fetcher}) store.commit('addFetcher', {timeline, fetcher})
} }
}, },
fetchOldPost (store, { postId }) {
store.state.backendInteractor.fetchOldPost({ store, postId })
},
stopFetching (store, timeline) { stopFetching (store, timeline) {
const fetcher = store.state.fetchers[timeline] const fetcher = store.state.fetchers[timeline]
window.clearInterval(fetcher) window.clearInterval(fetcher)

View file

@ -27,8 +27,7 @@ export const defaultState = {
maxId: 0, maxId: 0,
minId: Number.POSITIVE_INFINITY, minId: Number.POSITIVE_INFINITY,
data: [], data: [],
error: false, error: false
brokenFavorites: {}
}, },
favorites: new Set(), favorites: new Set(),
error: false, error: false,
@ -36,7 +35,6 @@ export const defaultState = {
mentions: emptyTl(), mentions: emptyTl(),
public: emptyTl(), public: emptyTl(),
user: emptyTl(), user: emptyTl(),
own: emptyTl(),
publicAndExternal: emptyTl(), publicAndExternal: emptyTl(),
friends: emptyTl(), friends: emptyTl(),
tag: emptyTl(), tag: emptyTl(),
@ -158,12 +156,6 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
const result = mergeOrAdd(allStatuses, allStatusesObject, status) const result = mergeOrAdd(allStatuses, allStatusesObject, status)
status = result.item status = result.item
const brokenFavorites = state.notifications.brokenFavorites[status.id] || []
brokenFavorites.forEach((fav) => {
fav.status = status
})
delete state.notifications.brokenFavorites[status.id]
if (result.new) { if (result.new) {
// We are mentioned in a post // We are mentioned in a post
if (statusType(status) === 'status' && find(status.attentions, { id: user.id })) { if (statusType(status) === 'status' && find(status.attentions, { id: user.id })) {
@ -304,7 +296,7 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
const fresh = !notification.is_seen const fresh = !notification.is_seen
const status = notification.ntype === 'like' const status = notification.ntype === 'like'
? find(allStatuses, { id: action.in_reply_to_status_id }) ? action.favorited_status
: action : action
const result = { const result = {
@ -314,17 +306,6 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
seen: !fresh seen: !fresh
} }
if (notification.ntype === 'like' && !status) {
let broken = state.notifications.brokenFavorites[action.in_reply_to_status_id]
if (broken) {
broken.push(result)
} else {
dispatch('fetchOldPost', { postId: action.in_reply_to_status_id })
broken = [ result ]
state.notifications.brokenFavorites[action.in_reply_to_status_id] = broken
}
}
state.notifications.data.push(result) state.notifications.data.push(result)
if ('Notification' in window && window.Notification.permission === 'granted') { if ('Notification' in window && window.Notification.permission === 'granted') {

View file

@ -195,8 +195,6 @@ const users = {
// Start getting fresh tweets. // Start getting fresh tweets.
store.dispatch('startFetching', 'friends') store.dispatch('startFetching', 'friends')
// Start getting our own posts, only really needed for mitigating broken favorites
store.dispatch('startFetching', ['own', user.id])
// Get user mutes and follower info // Get user mutes and follower info
store.rootState.api.backendInteractor.fetchMutes().then((mutedUsers) => { store.rootState.api.backendInteractor.fetchMutes().then((mutedUsers) => {

View file

@ -300,9 +300,6 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use
notifications: QVITTER_USER_NOTIFICATIONS_URL, notifications: QVITTER_USER_NOTIFICATIONS_URL,
'publicAndExternal': PUBLIC_AND_EXTERNAL_TIMELINE_URL, 'publicAndExternal': PUBLIC_AND_EXTERNAL_TIMELINE_URL,
user: QVITTER_USER_TIMELINE_URL, user: QVITTER_USER_TIMELINE_URL,
// separate timeline for own posts, so it won't break due to user timeline bugs
// really needed only for broken favorites
own: QVITTER_USER_TIMELINE_URL,
tag: TAG_TIMELINE_URL tag: TAG_TIMELINE_URL
} }

View file

@ -54,16 +54,6 @@ const backendInteractorService = (credentials) => {
return timelineFetcherService.startFetching({timeline, store, credentials, userId}) return timelineFetcherService.startFetching({timeline, store, credentials, userId})
} }
const fetchOldPost = ({store, postId}) => {
return timelineFetcherService.fetchAndUpdate({
store,
credentials,
timeline: 'own',
older: true,
until: postId + 1
})
}
const setUserMute = ({id, muted = true}) => { const setUserMute = ({id, muted = true}) => {
return apiService.setUserMute({id, muted, credentials}) return apiService.setUserMute({id, muted, credentials})
} }
@ -97,7 +87,6 @@ const backendInteractorService = (credentials) => {
fetchAllFollowing, fetchAllFollowing,
verifyCredentials: apiService.verifyCredentials, verifyCredentials: apiService.verifyCredentials,
startFetching, startFetching,
fetchOldPost,
setUserMute, setUserMute,
fetchMutes, fetchMutes,
register, register,