Merge branch 'sss-objects' into shigusegubu-themes3
This commit is contained in:
commit
47a6777284
6 changed files with 22 additions and 14 deletions
|
@ -66,7 +66,7 @@ const FilteringTab = {
|
|||
let valid = true
|
||||
try {
|
||||
new RegExp(value)
|
||||
} catch (e) {
|
||||
} catch {
|
||||
valid = false
|
||||
console.error('Invalid RegExp: ' + value)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
.muteFilterContainer {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--roundness);
|
||||
|
||||
height: 33vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
@ -12,7 +11,6 @@
|
|||
border-radius: var(--roundness);
|
||||
margin: 0.5em;
|
||||
padding: 0.5em;
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: fit-content() 1fr fit-content();
|
||||
align-items: baseline;
|
||||
|
@ -24,7 +22,8 @@
|
|||
grid-row: 1;
|
||||
}
|
||||
|
||||
.alert, .button-default {
|
||||
.alert,
|
||||
.button-default {
|
||||
display: inline-block;
|
||||
line-height: 2;
|
||||
padding: 0 0.5em;
|
||||
|
@ -33,7 +32,6 @@
|
|||
.filter-enabled {
|
||||
grid-column: 3;
|
||||
grid-row: 1;
|
||||
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<template>
|
||||
<div :label="$t('settings.filtering')" class="filtering-tab">
|
||||
<div
|
||||
:label="$t('settings.filtering')"
|
||||
class="filtering-tab"
|
||||
>
|
||||
<div class="setting-item">
|
||||
<h2>{{ $t('settings.posts') }}</h2>
|
||||
<ul class="setting-list">
|
||||
|
@ -74,7 +77,7 @@
|
|||
class="mute-filter"
|
||||
:style="{ order: filter[1].order }"
|
||||
v-for="filter in muteFilters"
|
||||
key="filter[0]"
|
||||
:key="filter[0]"
|
||||
>
|
||||
<div class="filter-name">
|
||||
<label
|
||||
|
|
|
@ -16,6 +16,7 @@ import generateProfileLink from 'src/services/user_profile_link_generator/user_p
|
|||
import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js'
|
||||
import { muteFilterHits } from '../../services/status_parser/status_parser.js'
|
||||
import { unescape, uniqBy } from 'lodash'
|
||||
import { useServerSideStorageStore } from 'src/stores/serverSideStorage'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
@ -219,7 +220,10 @@ const Status = {
|
|||
return !!this.currentUser
|
||||
},
|
||||
muteFilterHits () {
|
||||
return muteFilterHits(this.status)
|
||||
return muteFilterHits(
|
||||
Object.values(useServerSideStorageStore().prefsStorage.simple.muteFilters),
|
||||
this.status
|
||||
)
|
||||
},
|
||||
botStatus () {
|
||||
return this.status.user.actor_type === 'Service'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import apiService from '../services/api/api.service.js'
|
||||
import { useServerSideStorageStore } from 'src/stores/serverSideStorage'
|
||||
|
||||
import {
|
||||
isStatusNotification,
|
||||
|
@ -112,7 +113,11 @@ export const notifications = {
|
|||
commit('updateNotificationsMinMaxId', notification.id)
|
||||
commit('addNewNotifications', { notifications: [notification] })
|
||||
|
||||
maybeShowNotification(store, notification)
|
||||
maybeShowNotification(
|
||||
store,
|
||||
Object.values(useServerSideStorageStore().prefsStorage.simple.muteFilters),
|
||||
notification
|
||||
)
|
||||
} else if (notification.seen) {
|
||||
state.idStore[notification.id].seen = true
|
||||
}
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
import { useServerSideStorageStore } from 'src/stores/serverSideStorage'
|
||||
|
||||
export const muteFilterHits = (status) => {
|
||||
export const muteFilterHits = (muteFilters, status) => {
|
||||
const statusText = status.text.toLowerCase()
|
||||
const statusSummary = status.summary.toLowerCase()
|
||||
|
||||
const muteFilters = Object.values(useServerSideStorageStore().prefsStorage.simple.muteFilters)
|
||||
|
||||
return muteFilters.toSorted((a,b) => b.order - a.order).map(filter => {
|
||||
const { hide, expires, name, value, type, enabled} = filter
|
||||
if (!enabled) return false
|
||||
|
@ -15,6 +11,7 @@ export const muteFilterHits = (status) => {
|
|||
if (statusText.includes(value) || statusSummary.includes(value)) {
|
||||
return { hide, name }
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'regexp': {
|
||||
try {
|
||||
|
@ -22,6 +19,7 @@ export const muteFilterHits = (status) => {
|
|||
if (re.test(statusText) || re.test(statusSummary)) {
|
||||
return { hide, name }
|
||||
}
|
||||
return false
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue