Add extra filtering properties to the Home
This enables filtering replies and boosts/reblogs from the Home timeline. Fixes #628.
This commit is contained in:
parent
73a0f8bec1
commit
a2da445809
@ -67,6 +67,8 @@
|
|||||||
"filter": {
|
"filter": {
|
||||||
"title": "Filter",
|
"title": "Filter",
|
||||||
"placeholder": "Mit regulären Ausdrücken filtern",
|
"placeholder": "Mit regulären Ausdrücken filtern",
|
||||||
|
"show_reblogs": "Geteilte Beiträge anzeigen",
|
||||||
|
"show_replies": "Antworten anzeigen",
|
||||||
"apply": "Übernehmen"
|
"apply": "Übernehmen"
|
||||||
},
|
},
|
||||||
"new_toot": "Toot",
|
"new_toot": "Toot",
|
||||||
|
@ -68,6 +68,9 @@
|
|||||||
"filter": {
|
"filter": {
|
||||||
"title": "Filter",
|
"title": "Filter",
|
||||||
"placeholder": "Filter out by regular expressions",
|
"placeholder": "Filter out by regular expressions",
|
||||||
|
"show_dms": "Show direct messages",
|
||||||
|
"show_reblogs": "Show reblogs",
|
||||||
|
"show_replies": "Show replies",
|
||||||
"apply": "Apply"
|
"apply": "Apply"
|
||||||
},
|
},
|
||||||
"new_toot": "Toot",
|
"new_toot": "Toot",
|
||||||
|
@ -67,6 +67,8 @@
|
|||||||
"filter": {
|
"filter": {
|
||||||
"title": "Filtrer",
|
"title": "Filtrer",
|
||||||
"placeholder": "Filtrer par une expression régulière",
|
"placeholder": "Filtrer par une expression régulière",
|
||||||
|
"show_reblogs": "Afficher les partages",
|
||||||
|
"show_replies": "Afficher les réponses",
|
||||||
"apply": "Appliquer"
|
"apply": "Appliquer"
|
||||||
},
|
},
|
||||||
"new_toot": "Pouet",
|
"new_toot": "Pouet",
|
||||||
|
@ -68,6 +68,8 @@
|
|||||||
"filter": {
|
"filter": {
|
||||||
"title": "フィルター",
|
"title": "フィルター",
|
||||||
"placeholder": "正規表現でフィルター",
|
"placeholder": "正規表現でフィルター",
|
||||||
|
"show_reblogs": "ブースト表示",
|
||||||
|
"show_replies": "返信表示",
|
||||||
"apply": "適用"
|
"apply": "適用"
|
||||||
},
|
},
|
||||||
"new_toot": "トゥート",
|
"new_toot": "トゥート",
|
||||||
|
@ -67,6 +67,8 @@
|
|||||||
"filter": {
|
"filter": {
|
||||||
"title": "필터",
|
"title": "필터",
|
||||||
"placeholder": "정규식으로 필터링",
|
"placeholder": "정규식으로 필터링",
|
||||||
|
"show_reblogs": "부스트 표시",
|
||||||
|
"show_replies": "답글 표시",
|
||||||
"apply": "적용"
|
"apply": "적용"
|
||||||
},
|
},
|
||||||
"new_toot": "툿",
|
"new_toot": "툿",
|
||||||
|
@ -67,6 +67,8 @@
|
|||||||
"filter": {
|
"filter": {
|
||||||
"title": "Filtruj",
|
"title": "Filtruj",
|
||||||
"placeholder": "Filtruj z użyciem wyrażeń regularnych",
|
"placeholder": "Filtruj z użyciem wyrażeń regularnych",
|
||||||
|
"show_reblogs": "Pokazuj podbicia",
|
||||||
|
"show_replies": "Pokazuj odpowiedzi",
|
||||||
"apply": "Zastosuj"
|
"apply": "Zastosuj"
|
||||||
},
|
},
|
||||||
"new_toot": "Wpisy",
|
"new_toot": "Wpisy",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
|
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
|
||||||
</div>
|
</div>
|
||||||
<transition-group name="timeline" tag="div">
|
<transition-group name="timeline" tag="div">
|
||||||
<div class="home-timeline" v-for="message in timeline" :key="message.uri + message.id">
|
<div class="home-timeline" v-for="message in filteredTimeline" :key="message.uri + message.id">
|
||||||
<toot
|
<toot
|
||||||
:message="message"
|
:message="message"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
@ -52,7 +52,9 @@ export default {
|
|||||||
lazyLoading: state => state.TimelineSpace.Contents.Home.lazyLoading,
|
lazyLoading: state => state.TimelineSpace.Contents.Home.lazyLoading,
|
||||||
heading: state => state.TimelineSpace.Contents.Home.heading,
|
heading: state => state.TimelineSpace.Contents.Home.heading,
|
||||||
unread: state => state.TimelineSpace.Contents.Home.unreadTimeline,
|
unread: state => state.TimelineSpace.Contents.Home.unreadTimeline,
|
||||||
filter: state => state.TimelineSpace.Contents.Home.filter
|
filter: state => state.TimelineSpace.Contents.Home.filter,
|
||||||
|
showReblogs: state => state.TimelineSpace.Contents.Home.showReblogs,
|
||||||
|
showReplies: state => state.TimelineSpace.Contents.Home.showReplies
|
||||||
}),
|
}),
|
||||||
...mapGetters('TimelineSpace/Modals', [
|
...mapGetters('TimelineSpace/Modals', [
|
||||||
'modalOpened'
|
'modalOpened'
|
||||||
@ -67,6 +69,17 @@ export default {
|
|||||||
// Sometimes toots are deleted, so perhaps focused toot don't exist.
|
// Sometimes toots are deleted, so perhaps focused toot don't exist.
|
||||||
const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri + toot.id)
|
const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri + toot.id)
|
||||||
return currentIndex === -1
|
return currentIndex === -1
|
||||||
|
},
|
||||||
|
filteredTimeline () {
|
||||||
|
return this.timeline.filter((toot) => {
|
||||||
|
if (toot.in_reply_to_id) {
|
||||||
|
return this.showReplies
|
||||||
|
} else if (toot.reblog) {
|
||||||
|
return this.showReblogs
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
@ -27,6 +27,12 @@
|
|||||||
></input>
|
></input>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('header_menu.filter.show_reblogs')" v-if="extrasFilterable()">
|
||||||
|
<el-checkbox v-model="showReblogs"></el-checkbox>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('header_menu.filter.show_replies')" v-if="extrasFilterable()">
|
||||||
|
<el-checkbox v-model="showReplies"></el-checkbox>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="applyFilter(filter)">{{ $t('header_menu.filter.apply') }}</el-button>
|
<el-button type="primary" @click="applyFilter(filter)">{{ $t('header_menu.filter.apply') }}</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -51,7 +57,9 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
filter: '',
|
filter: '',
|
||||||
filterVisible: false
|
filterVisible: false,
|
||||||
|
showReblogs: true,
|
||||||
|
showReplies: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -155,6 +163,8 @@ export default {
|
|||||||
switch (this.$route.name) {
|
switch (this.$route.name) {
|
||||||
case 'home':
|
case 'home':
|
||||||
this.filter = this.$store.state.TimelineSpace.Contents.Home.filter
|
this.filter = this.$store.state.TimelineSpace.Contents.Home.filter
|
||||||
|
this.showReblogs = this.$store.state.TimelineSpace.Contents.Home.showReblogs
|
||||||
|
this.showReplies = this.$store.state.TimelineSpace.Contents.Home.showReplies
|
||||||
break
|
break
|
||||||
case 'notifications':
|
case 'notifications':
|
||||||
this.filter = this.$store.state.TimelineSpace.Contents.Notifications.filter
|
this.filter = this.$store.state.TimelineSpace.Contents.Notifications.filter
|
||||||
@ -185,6 +195,8 @@ export default {
|
|||||||
switch (this.$route.name) {
|
switch (this.$route.name) {
|
||||||
case 'home':
|
case 'home':
|
||||||
this.$store.commit('TimelineSpace/Contents/Home/changeFilter', filter)
|
this.$store.commit('TimelineSpace/Contents/Home/changeFilter', filter)
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Home/showReblogs', this.showReblogs)
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Home/showReplies', this.showReplies)
|
||||||
break
|
break
|
||||||
case 'notifications':
|
case 'notifications':
|
||||||
this.$store.commit('TimelineSpace/Contents/Notifications/changeFilter', filter)
|
this.$store.commit('TimelineSpace/Contents/Notifications/changeFilter', filter)
|
||||||
@ -227,6 +239,14 @@ export default {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
extrasFilterable () {
|
||||||
|
switch (this.$route.name) {
|
||||||
|
case 'home':
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
settings () {
|
settings () {
|
||||||
const url = `/${this.id()}/settings`
|
const url = `/${this.id()}/settings`
|
||||||
this.$router.push(url)
|
this.$router.push(url)
|
||||||
|
@ -7,7 +7,9 @@ const Home = {
|
|||||||
heading: true,
|
heading: true,
|
||||||
timeline: [],
|
timeline: [],
|
||||||
unreadTimeline: [],
|
unreadTimeline: [],
|
||||||
filter: ''
|
filter: '',
|
||||||
|
showReblogs: true,
|
||||||
|
showReplies: true
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
changeLazyLoading (state, value) {
|
changeLazyLoading (state, value) {
|
||||||
@ -68,6 +70,12 @@ const Home = {
|
|||||||
},
|
},
|
||||||
changeFilter (state, filter) {
|
changeFilter (state, filter) {
|
||||||
state.filter = filter
|
state.filter = filter
|
||||||
|
},
|
||||||
|
showReblogs (state, visible) {
|
||||||
|
state.showReblogs = visible
|
||||||
|
},
|
||||||
|
showReplies (state, visible) {
|
||||||
|
state.showReplies = visible
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user