aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/notification/notification.vue5
-rw-r--r--src/components/notifications/notifications.scss10
-rw-r--r--src/components/post_status_form/post_status_form.js6
-rw-r--r--src/components/registration/registration.js2
-rw-r--r--src/components/registration/registration.vue7
-rw-r--r--src/components/settings/settings.js12
-rw-r--r--src/components/status/status.js4
-rw-r--r--src/components/tab_switcher/tab_switcher.scss1
-rw-r--r--src/components/timeline/timeline.js36
-rw-r--r--src/components/timeline/timeline.vue33
-rw-r--r--src/components/user_card/user_card.js4
-rw-r--r--src/components/user_card/user_card.vue10
-rw-r--r--src/components/user_card_content/user_card_content.vue28
-rw-r--r--src/components/user_profile/user_profile.js29
-rw-r--r--src/components/user_profile/user_profile.vue66
-rw-r--r--src/i18n/en.json2
-rw-r--r--src/modules/api.js3
-rw-r--r--src/modules/statuses.js40
-rw-r--r--src/modules/users.js19
-rw-r--r--src/services/api/api.service.js3
-rw-r--r--src/services/backend_interactor_service/backend_interactor_service.js11
21 files changed, 158 insertions, 173 deletions
diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue
index 1c89cbb7..56791d45 100644
--- a/src/components/notification/notification.vue
+++ b/src/components/notification/notification.vue
@@ -33,10 +33,7 @@
</router-link>
</div>
<template v-else>
- <status :activatePanel="activatePanel" v-if="notification.status" class="faint" :compact="true" :statusoid="notification.status" :noHeading="true"></status>
- <div class="broken-favorite" v-else>
- {{$t('notifications.broken_favorite')}}
- </div>
+ <status :activatePanel="activatePanel" class="faint" :compact="true" :statusoid="notification.status" :noHeading="true"></status>
</template>
</div>
</div>
diff --git a/src/components/notifications/notifications.scss b/src/components/notifications/notifications.scss
index a6468e01..5c4ca1b9 100644
--- a/src/components/notifications/notifications.scss
+++ b/src/components/notifications/notifications.scss
@@ -36,16 +36,6 @@
border-color: $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 {
width: 32px;
height: 32px;
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index 2435074b..8a4e2489 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -43,12 +43,16 @@ const PostStatusForm = {
const preset = this.$route.query.message
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) {
const currentUser = this.$store.state.users.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.$store.state.users.currentUser.default_scope
diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js
index 65b2fb9b..dd8e6e5d 100644
--- a/src/components/registration/registration.js
+++ b/src/components/registration/registration.js
@@ -48,8 +48,10 @@ const registration = {
async submit () {
this.user.nickname = this.user.username
this.user.token = this.token
+
this.user.captcha_solution = this.captcha.solution
this.user.captcha_token = this.captcha.token
+ this.user.captcha_answer_data = this.captcha.answer_data
this.$v.$touch()
diff --git a/src/components/registration/registration.vue b/src/components/registration/registration.vue
index f187e215..1455354e 100644
--- a/src/components/registration/registration.vue
+++ b/src/components/registration/registration.vue
@@ -76,15 +76,16 @@
</div>
<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'">
<img v-bind:src="captcha.url" v-on:click="setCaptcha">
- <sub>Click the image to get a new captcha</sub>
- <label class='form--label' for='captcha-label'>CAPTCHA</label>
+ <sub>{{$t('registration.new_captcha')}}</sub>
<input :disabled="isPending"
v-model='captcha.solution'
- class='form-control' id='captcha-answer' type='text'>
+ class='form-control' id='captcha-answer' type='text' autocomplete="off">
</template>
</div>
diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index 681ccda8..d45ec72d 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -15,14 +15,17 @@ const settings = {
hideNsfwLocal: user.hideNsfw,
hideISPLocal: user.hideISP,
preloadImage: user.preloadImage,
+
hidePostStatsLocal: typeof user.hidePostStats === 'undefined'
? instance.hidePostStats
: user.hidePostStats,
hidePostStatsDefault: this.$t('settings.values.' + instance.hidePostStats),
+
hideUserStatsLocal: typeof user.hideUserStats === 'undefined'
? instance.hideUserStats
: user.hideUserStats,
hideUserStatsDefault: this.$t('settings.values.' + instance.hideUserStats),
+
notificationVisibilityLocal: user.notificationVisibility,
replyVisibilityLocal: user.replyVisibility,
loopVideoLocal: user.loopVideo,
@@ -32,20 +35,27 @@ const settings = {
streamingLocal: user.streaming,
pauseOnUnfocusedLocal: user.pauseOnUnfocused,
hoverPreviewLocal: user.hoverPreview,
+
collapseMessageWithSubjectLocal: typeof user.collapseMessageWithSubject === 'undefined'
? instance.collapseMessageWithSubject
: user.collapseMessageWithSubject,
collapseMessageWithSubjectDefault: this.$t('settings.values.' + instance.collapseMessageWithSubject),
+
subjectLineBehaviorLocal: typeof user.subjectLineBehavior === 'undefined'
? instance.subjectLineBehavior
: user.subjectLineBehavior,
subjectLineBehaviorDefault: instance.subjectLineBehavior,
+
alwaysShowSubjectInputLocal: typeof user.alwaysShowSubjectInput === 'undefined'
? instance.alwaysShowSubjectInput
: user.alwaysShowSubjectInput,
alwaysShowSubjectInputDefault: instance.alwaysShowSubjectInput,
- scopeCopyLocal: user.scopeCopy,
+
+ scopeCopyLocal: typeof user.scopeCopy === 'undefined'
+ ? instance.scopeCopy
+ : user.scopeCopy,
scopeCopyDefault: this.$t('settings.values.' + instance.scopeCopy),
+
stopGifs: user.stopGifs,
webPushNotificationsLocal: user.webPushNotifications,
loopSilentAvailable:
diff --git a/src/components/status/status.js b/src/components/status/status.js
index 47a62fdf..e683056f 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -188,7 +188,9 @@ const Status = {
},
replySubject () {
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)
if (behavior !== 'noop' && startsWithRe || behavior === 'masto') {
return this.status.summary
diff --git a/src/components/tab_switcher/tab_switcher.scss b/src/components/tab_switcher/tab_switcher.scss
index 428335c0..f7449439 100644
--- a/src/components/tab_switcher/tab_switcher.scss
+++ b/src/components/tab_switcher/tab_switcher.scss
@@ -26,7 +26,6 @@
.tab-wrapper {
height: 28px;
- overflow: hidden;
position: relative;
display: flex;
flex: 0 0 auto;
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js
index f28b85bd..98da8660 100644
--- a/src/components/timeline/timeline.js
+++ b/src/components/timeline/timeline.js
@@ -10,7 +10,8 @@ const Timeline = {
'timelineName',
'title',
'userId',
- 'tag'
+ 'tag',
+ 'embedded'
],
data () {
return {
@@ -20,15 +21,6 @@ const Timeline = {
},
computed: {
timelineError () { return this.$store.state.statuses.error },
- followers () {
- return this.timeline.followers
- },
- friends () {
- return this.timeline.friends
- },
- viewing () {
- return this.timeline.viewing
- },
newStatusCount () {
return this.timeline.newStatusCount
},
@@ -38,6 +30,14 @@ const Timeline = {
} else {
return ` (${this.newStatusCount})`
}
+ },
+ classes () {
+ return {
+ root: ['timeline'].concat(!this.embedded ? ['panel', 'panel-default'] : []),
+ header: ['timeline-heading'].concat(!this.embedded ? ['panel-heading'] : []),
+ body: ['timeline-body'].concat(!this.embedded ? ['panel-body'] : []),
+ footer: ['timeline-footer'].concat(!this.embedded ? ['panel-footer'] : [])
+ }
}
},
components: {
@@ -60,12 +60,6 @@ const Timeline = {
userId: this.userId,
tag: this.tag
})
-
- // don't fetch followers for public, friend, twkn
- if (this.timelineName === 'user') {
- this.fetchFriends()
- this.fetchFollowers()
- }
},
mounted () {
if (typeof document.hidden !== 'undefined') {
@@ -103,16 +97,6 @@ const Timeline = {
tag: this.tag
}).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false }))
}, 1000, this),
- fetchFollowers () {
- const id = this.userId
- this.$store.state.api.backendInteractor.fetchFollowers({ id })
- .then((followers) => this.$store.dispatch('addFollowers', { followers }))
- },
- fetchFriends () {
- const id = this.userId
- this.$store.state.api.backendInteractor.fetchFriends({ id })
- .then((friends) => this.$store.dispatch('addFriends', { friends }))
- },
scrollLoad (e) {
const bodyBRect = document.body.getBoundingClientRect()
const height = Math.max(bodyBRect.height, -(bodyBRect.y))
diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue
index bc7f74c2..6ba598c5 100644
--- a/src/components/timeline/timeline.vue
+++ b/src/components/timeline/timeline.vue
@@ -1,6 +1,6 @@
<template>
- <div class="timeline panel panel-default" v-if="viewing == 'statuses'">
- <div class="panel-heading timeline-heading">
+ <div :class="classes.root">
+ <div :class="classes.header">
<div class="title">
{{title}}
</div>
@@ -14,43 +14,20 @@
{{$t('timeline.up_to_date')}}
</div>
</div>
- <div class="panel-body">
+ <div :class="classes.body">
<div class="timeline">
<status-or-conversation v-for="status in timeline.visibleStatuses" :key="status.id" v-bind:statusoid="status" class="status-fadein"></status-or-conversation>
</div>
</div>
- <div class="panel-footer">
+ <div :class="classes.footer">
<a href="#" v-on:click.prevent='fetchOlderStatuses()' v-if="!timeline.loading">
<div class="new-status-notification text-center panel-footer">{{$t('timeline.load_older')}}</div>
</a>
<div class="new-status-notification text-center panel-footer" v-else>...</div>
</div>
</div>
- <div class="timeline panel panel-default" v-else-if="viewing == 'followers'">
- <div class="panel-heading timeline-heading">
- <div class="title">
- {{$t('user_card.followers')}}
- </div>
- </div>
- <div class="panel-body">
- <div class="timeline">
- <user-card v-for="follower in followers" :key="follower.id" :user="follower" :showFollows="false"></user-card>
- </div>
- </div>
- </div>
- <div class="timeline panel panel-default" v-else-if="viewing == 'friends'">
- <div class="panel-heading timeline-heading">
- <div class="title">
- {{$t('user_card.followees')}}
- </div>
- </div>
- <div class="panel-body">
- <div class="timeline">
- <user-card v-for="friend in friends" :key="friend.id" :user="friend" :showFollows="true"></user-card>
- </div>
- </div>
- </div>
</template>
+
<script src="./timeline.js"></script>
<style lang="scss">
diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js
index ea893567..f0fff335 100644
--- a/src/components/user_card/user_card.js
+++ b/src/components/user_card/user_card.js
@@ -1,4 +1,5 @@
import UserCardContent from '../user_card_content/user_card_content.vue'
+import StillImage from '../still-image/still-image.vue'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
const UserCard = {
@@ -13,7 +14,8 @@ const UserCard = {
}
},
components: {
- UserCardContent
+ UserCardContent,
+ StillImage
},
computed: {
currentUser () { return this.$store.state.users.currentUser }
diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue
index 0f163e36..cf69606d 100644
--- a/src/components/user_card/user_card.vue
+++ b/src/components/user_card/user_card.vue
@@ -1,7 +1,7 @@
<template>
<div class="card">
<a href="#">
- <img @click.prevent="toggleUserExpanded" class="avatar" :src="user.profile_image_url">
+ <StillImage @click.prevent="toggleUserExpanded" class="avatar" :src="user.profile_image_url"/>
</a>
<div class="usercard" v-if="userExpanded">
<user-card-content :user="user" :switcher="false"></user-card-content>
@@ -41,6 +41,14 @@
margin-top:0.0em;
text-align: left;
width: 100%;
+ .user-name {
+ img {
+ object-fit: contain;
+ height: 16px;
+ width: 16px;
+ vertical-align: middle;
+ }
+ }
}
.follows-you {
diff --git a/src/components/user_card_content/user_card_content.vue b/src/components/user_card_content/user_card_content.vue
index 1b6ccfaa..c5222519 100644
--- a/src/components/user_card_content/user_card_content.vue
+++ b/src/components/user_card_content/user_card_content.vue
@@ -104,16 +104,16 @@
</div>
</div>
<div class="panel-body profile-panel-body" v-if="!hideBio">
- <div v-if="!hideUserStatsLocal || switcher" class="user-counts" :class="{clickable: switcher}">
- <div class="user-count" v-on:click.prevent="setProfileView('statuses')" :class="{selected: selected === 'statuses'}">
+ <div v-if="!hideUserStatsLocal || switcher" class="user-counts">
+ <div class="user-count" v-on:click.prevent="setProfileView('statuses')">
<h5>{{ $t('user_card.statuses') }}</h5>
<span v-if="!hideUserStatsLocal">{{user.statuses_count}} <br></span>
</div>
- <div class="user-count" v-on:click.prevent="setProfileView('friends')" :class="{selected: selected === 'friends'}">
+ <div class="user-count" v-on:click.prevent="setProfileView('friends')">
<h5>{{ $t('user_card.followees') }}</h5>
<span v-if="!hideUserStatsLocal">{{user.friends_count}}</span>
</div>
- <div class="user-count" v-on:click.prevent="setProfileView('followers')" :class="{selected: selected === 'followers'}">
+ <div class="user-count" v-on:click.prevent="setProfileView('followers')">
<h5>{{ $t('user_card.followers') }}</h5>
<span v-if="!hideUserStatsLocal">{{user.followers_count}}</span>
</div>
@@ -304,18 +304,6 @@
justify-content: space-between;
color: $fallback--lightText;
color: var(--lightText, $fallback--lightText);
-
- &.clickable {
- .user-count {
- cursor: pointer;
-
- &:hover:not(.selected) {
- transition: border-bottom 100ms;
- border-bottom: 3px solid $fallback--link;
- border-bottom: 3px solid var(--link, $fallback--link);
- }
- }
- }
}
.user-count {
@@ -323,14 +311,6 @@
padding: .5em 0 .5em 0;
margin: 0 .5em;
- &.selected {
- transition: none;
- border-bottom: 5px solid $fallback--link;
- border-bottom: 5px solid var(--link, $fallback--link);
- border-radius: $fallback--btnRadius;
- border-radius: var(--btnRadius, $fallback--btnRadius);
- }
-
h5 {
font-size:1em;
font-weight: bolder;
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js
index 95d797a2..77bb1835 100644
--- a/src/components/user_profile/user_profile.js
+++ b/src/components/user_profile/user_profile.js
@@ -1,9 +1,9 @@
import UserCardContent from '../user_card_content/user_card_content.vue'
+import UserCard from '../user_card/user_card.vue'
import Timeline from '../timeline/timeline.vue'
const UserProfile = {
created () {
- debugger
this.$store.commit('clearTimeline', { timeline: 'user' })
this.$store.dispatch('startFetching', ['user', this.fetchBy])
if (!this.user) {
@@ -18,18 +18,24 @@ const UserProfile = {
return this.$store.state.statuses.timelines.user
},
userId () {
- return this.$route.params.id
+ return this.$route.params.id || this.user.id
},
userName () {
return this.$route.params.name
},
+ friends () {
+ return this.user.friends
+ },
+ followers () {
+ return this.user.followers
+ },
user () {
if (this.timeline.statuses[0]) {
return this.timeline.statuses[0].user
} else {
return Object.values(this.$store.state.users.usersObject).filter(user => {
return (this.isExternal ? user.id === this.userId : user.screen_name === this.userName)
- })[0] || false
+ })[0] || {}
}
},
fetchBy () {
@@ -39,6 +45,16 @@ const UserProfile = {
return this.$route.name === 'external-user-profile'
}
},
+ methods: {
+ fetchFollowers () {
+ const id = this.userId
+ this.$store.dispatch('addFollowers', { id })
+ },
+ fetchFriends () {
+ const id = this.userId
+ this.$store.dispatch('addFriends', { id })
+ }
+ },
watch: {
userName () {
if (this.isExternal) {
@@ -55,10 +71,17 @@ const UserProfile = {
this.$store.dispatch('stopFetching', 'user')
this.$store.commit('clearTimeline', { timeline: 'user' })
this.$store.dispatch('startFetching', ['user', this.userId])
+ },
+ user () {
+ if (this.user.id && !this.user.followers) {
+ this.fetchFollowers()
+ this.fetchFriends()
+ }
}
},
components: {
UserCardContent,
+ UserCard,
Timeline
}
}
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index 4d2853a6..84fdba45 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -1,20 +1,38 @@
<template>
- <div>
- <div v-if="user" class="user-profile panel panel-default">
- <user-card-content :user="user" :switcher="true" :selected="timeline.viewing"></user-card-content>
- </div>
- <div v-else class="panel user-profile-placeholder">
- <div class="panel-heading">
- <div class="title">
- {{ $t('settings.profile_tab') }}
+<div>
+ <div v-if="user.id" class="user-profile panel panel-default">
+ <user-card-content :user="user" :switcher="true" :selected="timeline.viewing"></user-card-content>
+ <tab-switcher>
+ <Timeline :label="$t('user_card.statuses')" :embedded="true" :title="$t('user_profile.timeline_title')" :timeline="timeline" :timeline-name="'user'" :user-id="userId"/>
+ <div :label="$t('user_card.followees')">
+ <div v-if="friends">
+ <user-card v-for="friend in friends" :key="friend.id" :user="friend" :showFollows="true"></user-card>
+ </div>
+ <div class="userlist-placeholder" v-else>
+ <i class="icon-spin3 animate-spin"></i>
+ </div>
+ </div>
+ <div :label="$t('user_card.followers')">
+ <div v-if="followers">
+ <user-card v-for="follower in followers" :key="follower.id" :user="follower" :showFollows="false"></user-card>
+ </div>
+ <div class="userlist-placeholder" v-else>
+ <i class="icon-spin3 animate-spin"></i>
</div>
</div>
- <div class="panel-body">
- <i class="icon-spin3 animate-spin"></i>
+ </tab-switcher>
+ </div>
+ <div v-else class="panel user-profile-placeholder">
+ <div class="panel-heading">
+ <div class="title">
+ {{ $t('settings.profile_tab') }}
</div>
</div>
- <Timeline :title="$t('user_profile.timeline_title')" :timeline="timeline" :timeline-name="'user'" :user-id="userId"/>
+ <div class="panel-body">
+ <i class="icon-spin3 animate-spin"></i>
+ </div>
</div>
+</div>
</template>
<script src="./user_profile.js"></script>
@@ -24,12 +42,36 @@
.user-profile {
flex: 2;
flex-basis: 500px;
- padding-bottom: 10px;
+
.panel-heading {
background: transparent;
flex-direction: column;
align-items: stretch;
}
+ .userlist-placeholder {
+ display: flex;
+ justify-content: center;
+ align-items: middle;
+ padding: 2em;
+ }
+
+ .timeline-heading {
+ display: flex;
+ justify-content: center;
+
+ .loadmore-button, .alert {
+ flex: 1;
+ }
+
+ .loadmore-button {
+ height: 28px;
+ margin: 10px .6em;
+ }
+
+ .title, .loadmore-text {
+ display: none
+ }
+ }
}
.user-profile-placeholder {
.panel-body {
diff --git a/src/i18n/en.json b/src/i18n/en.json
index f445bfc2..3662c6f6 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -74,6 +74,8 @@
"password_confirm": "Password confirmation",
"registration": "Registration",
"token": "Invite token",
+ "captcha": "CAPTCHA",
+ "new_captcha": "Click the image to get a new captcha",
"validations": {
"username_required": "cannot be left blank",
"fullname_required": "cannot be left blank",
diff --git a/src/modules/api.js b/src/modules/api.js
index 2f07a91e..a61340c2 100644
--- a/src/modules/api.js
+++ b/src/modules/api.js
@@ -46,9 +46,6 @@ const api = {
store.commit('addFetcher', {timeline, fetcher})
}
},
- fetchOldPost (store, { postId }) {
- store.state.backendInteractor.fetchOldPost({ store, postId })
- },
stopFetching (store, timeline) {
const fetcher = store.state.fetchers[timeline]
window.clearInterval(fetcher)
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index 8cdd4e28..8c2d36bc 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -14,7 +14,6 @@ const emptyTl = () => ({
loading: false,
followers: [],
friends: [],
- viewing: 'statuses',
userId: 0,
flushMarker: 0
})
@@ -28,8 +27,7 @@ export const defaultState = {
maxId: 0,
minId: Number.POSITIVE_INFINITY,
data: [],
- error: false,
- brokenFavorites: {}
+ error: false
},
favorites: new Set(),
error: false,
@@ -37,7 +35,6 @@ export const defaultState = {
mentions: emptyTl(),
public: emptyTl(),
user: emptyTl(),
- own: emptyTl(),
publicAndExternal: emptyTl(),
friends: emptyTl(),
tag: emptyTl(),
@@ -159,12 +156,6 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
const result = mergeOrAdd(allStatuses, allStatusesObject, status)
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) {
// We are mentioned in a post
if (statusType(status) === 'status' && find(status.attentions, { id: user.id })) {
@@ -305,7 +296,7 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
const fresh = !notification.is_seen
const status = notification.ntype === 'like'
- ? find(allStatuses, { id: action.in_reply_to_status_id })
+ ? action.favorited_status
: action
const result = {
@@ -315,17 +306,6 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
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)
if ('Notification' in window && window.Notification.permission === 'granted') {
@@ -399,16 +379,6 @@ export const mutations = {
setNotificationsSilence (state, { value }) {
state.notifications.desktopNotificationSilence = value
},
- setProfileView (state, { v }) {
- // load followers / friends only when needed
- state.timelines['user'].viewing = v
- },
- addFriends (state, { friends }) {
- state.timelines['user'].friends = friends
- },
- addFollowers (state, { followers }) {
- state.timelines['user'].followers = followers
- },
markNotificationsAsSeen (state) {
each(state.notifications.data, (notification) => {
notification.seen = true
@@ -437,12 +407,6 @@ const statuses = {
setNotificationsSilence ({ rootState, commit }, { value }) {
commit('setNotificationsSilence', { value })
},
- addFriends ({ rootState, commit }, { friends }) {
- commit('addFriends', { friends })
- },
- addFollowers ({ rootState, commit }, { followers }) {
- commit('addFollowers', { followers })
- },
deleteStatus ({ rootState, commit }, status) {
commit('setDeleted', { status })
apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials })
diff --git a/src/modules/users.js b/src/modules/users.js
index 65b172bc..13d3f26e 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -51,6 +51,15 @@ export const mutations = {
endLogin (state) {
state.loggingIn = false
},
+ // TODO Clean after ourselves?
+ addFriends (state, { id, friends }) {
+ const user = state.usersObject[id]
+ user.friends = friends
+ },
+ addFollowers (state, { id, followers }) {
+ const user = state.usersObject[id]
+ user.followers = followers
+ },
addNewUsers (state, users) {
each(users, (user) => mergeOrAdd(state.users, state.usersObject, user))
},
@@ -92,6 +101,14 @@ const users = {
store.rootState.api.backendInteractor.fetchUser({ id })
.then((user) => store.commit('addNewUsers', [user]))
},
+ addFriends ({ rootState, commit }, { id }) {
+ rootState.api.backendInteractor.fetchFriends({ id })
+ .then((friends) => commit('addFriends', { id, friends }))
+ },
+ addFollowers ({ rootState, commit }, { id }) {
+ rootState.api.backendInteractor.fetchFollowers({ id })
+ .then((followers) => commit('addFollowers', { id, followers }))
+ },
registerPushNotifications (store) {
const token = store.state.currentUser.credentials
const vapidPublicKey = store.rootState.instance.vapidPublicKey
@@ -178,8 +195,6 @@ const users = {
// Start getting fresh tweets.
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
store.rootState.api.backendInteractor.fetchMutes().then((mutedUsers) => {
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index b509c905..182f9126 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -300,9 +300,6 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use
notifications: QVITTER_USER_NOTIFICATIONS_URL,
'publicAndExternal': PUBLIC_AND_EXTERNAL_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
}
diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js
index cc72f607..f44f52b6 100644
--- a/src/services/backend_interactor_service/backend_interactor_service.js
+++ b/src/services/backend_interactor_service/backend_interactor_service.js
@@ -54,16 +54,6 @@ const backendInteractorService = (credentials) => {
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}) => {
return apiService.setUserMute({id, muted, credentials})
}
@@ -97,7 +87,6 @@ const backendInteractorService = (credentials) => {
fetchAllFollowing,
verifyCredentials: apiService.verifyCredentials,
startFetching,
- fetchOldPost,
setUserMute,
fetchMutes,
register,