mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-02-10 08:40:39 +01:00
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": {
|
||||
"title": "Filter",
|
||||
"placeholder": "Mit regulären Ausdrücken filtern",
|
||||
"show_reblogs": "Geteilte Beiträge anzeigen",
|
||||
"show_replies": "Antworten anzeigen",
|
||||
"apply": "Übernehmen"
|
||||
},
|
||||
"new_toot": "Toot",
|
||||
|
@ -68,6 +68,9 @@
|
||||
"filter": {
|
||||
"title": "Filter",
|
||||
"placeholder": "Filter out by regular expressions",
|
||||
"show_dms": "Show direct messages",
|
||||
"show_reblogs": "Show reblogs",
|
||||
"show_replies": "Show replies",
|
||||
"apply": "Apply"
|
||||
},
|
||||
"new_toot": "Toot",
|
||||
|
@ -67,6 +67,8 @@
|
||||
"filter": {
|
||||
"title": "Filtrer",
|
||||
"placeholder": "Filtrer par une expression régulière",
|
||||
"show_reblogs": "Afficher les partages",
|
||||
"show_replies": "Afficher les réponses",
|
||||
"apply": "Appliquer"
|
||||
},
|
||||
"new_toot": "Pouet",
|
||||
|
@ -68,6 +68,8 @@
|
||||
"filter": {
|
||||
"title": "フィルター",
|
||||
"placeholder": "正規表現でフィルター",
|
||||
"show_reblogs": "ブースト表示",
|
||||
"show_replies": "返信表示",
|
||||
"apply": "適用"
|
||||
},
|
||||
"new_toot": "トゥート",
|
||||
|
@ -67,6 +67,8 @@
|
||||
"filter": {
|
||||
"title": "필터",
|
||||
"placeholder": "정규식으로 필터링",
|
||||
"show_reblogs": "부스트 표시",
|
||||
"show_replies": "답글 표시",
|
||||
"apply": "적용"
|
||||
},
|
||||
"new_toot": "툿",
|
||||
|
@ -67,6 +67,8 @@
|
||||
"filter": {
|
||||
"title": "Filtruj",
|
||||
"placeholder": "Filtruj z użyciem wyrażeń regularnych",
|
||||
"show_reblogs": "Pokazuj podbicia",
|
||||
"show_replies": "Pokazuj odpowiedzi",
|
||||
"apply": "Zastosuj"
|
||||
},
|
||||
"new_toot": "Wpisy",
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
|
||||
</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
|
||||
:message="message"
|
||||
:filter="filter"
|
||||
@ -52,7 +52,9 @@ export default {
|
||||
lazyLoading: state => state.TimelineSpace.Contents.Home.lazyLoading,
|
||||
heading: state => state.TimelineSpace.Contents.Home.heading,
|
||||
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', [
|
||||
'modalOpened'
|
||||
@ -67,6 +69,17 @@ export default {
|
||||
// Sometimes toots are deleted, so perhaps focused toot don't exist.
|
||||
const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri + toot.id)
|
||||
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 () {
|
||||
|
@ -27,6 +27,12 @@
|
||||
></input>
|
||||
</div>
|
||||
</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-button type="primary" @click="applyFilter(filter)">{{ $t('header_menu.filter.apply') }}</el-button>
|
||||
</el-form-item>
|
||||
@ -51,7 +57,9 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
filter: '',
|
||||
filterVisible: false
|
||||
filterVisible: false,
|
||||
showReblogs: true,
|
||||
showReplies: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -155,6 +163,8 @@ export default {
|
||||
switch (this.$route.name) {
|
||||
case 'home':
|
||||
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
|
||||
case 'notifications':
|
||||
this.filter = this.$store.state.TimelineSpace.Contents.Notifications.filter
|
||||
@ -185,6 +195,8 @@ export default {
|
||||
switch (this.$route.name) {
|
||||
case 'home':
|
||||
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
|
||||
case 'notifications':
|
||||
this.$store.commit('TimelineSpace/Contents/Notifications/changeFilter', filter)
|
||||
@ -227,6 +239,14 @@ export default {
|
||||
return false
|
||||
}
|
||||
},
|
||||
extrasFilterable () {
|
||||
switch (this.$route.name) {
|
||||
case 'home':
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
},
|
||||
settings () {
|
||||
const url = `/${this.id()}/settings`
|
||||
this.$router.push(url)
|
||||
|
@ -7,7 +7,9 @@ const Home = {
|
||||
heading: true,
|
||||
timeline: [],
|
||||
unreadTimeline: [],
|
||||
filter: ''
|
||||
filter: '',
|
||||
showReblogs: true,
|
||||
showReplies: true
|
||||
},
|
||||
mutations: {
|
||||
changeLazyLoading (state, value) {
|
||||
@ -68,6 +70,12 @@ const Home = {
|
||||
},
|
||||
changeFilter (state, filter) {
|
||||
state.filter = filter
|
||||
},
|
||||
showReblogs (state, visible) {
|
||||
state.showReblogs = visible
|
||||
},
|
||||
showReplies (state, visible) {
|
||||
state.showReplies = visible
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user