Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve mute #553

Merged
merged 4 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/app/shared/FeedItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
import {derived} from "svelte/store"
import NoteMeta from "src/app/shared/NoteMeta.svelte"
import Note from "src/app/shared/Note.svelte"
import {ensureUnwrapped, getSetting, isEventMuted, loadEvent, sortEventsDesc} from "src/engine"
import {
ensureUnwrapped,
getSetting,
isEventMuted,
loadEvent,
sortEventsDesc,
userSettings,
} from "src/engine"
import AltColor from "src/partials/AltColor.svelte"
import Popover from "src/partials/Popover.svelte"
import Spinner from "src/partials/Spinner.svelte"
Expand Down Expand Up @@ -205,7 +212,7 @@
{/each}
{/key}
{/if}
{#if showHiddenReplies && mutedReplies.length > 0}
{#if showHiddenReplies && mutedReplies.length > 0 && !$userSettings.ignore_muted_content}
<button
class="cursor-pointer rounded-md bg-gradient-to-l from-transparent via-tinted-700 to-tinted-700 py-2 text-neutral-100 outline-0 transition-colors hover:bg-tinted-700"
on:click={() => {
Expand Down
5 changes: 5 additions & 0 deletions src/app/views/UserContent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
If enabled, content flagged by the author as potentially sensitive will be hidden.
</p>
</FieldInline>

<Field>
<div slot="label" class="flex justify-between">
<strong>Minimum WoT score</strong>
Expand Down Expand Up @@ -99,6 +100,10 @@
termToItem={identity} />
<p slot="info">Notes containing these words will be hidden by default.</p>
</Field>
<FieldInline label="Ignore muted content">
<Toggle bind:value={values.ignore_muted_content} />
<p slot="info">If enabled, muted replies will be ignored.</p>
</FieldInline>
</div>
<Footer>
<Anchor grow button tag="button" type="submit">Save</Anchor>
Expand Down
4 changes: 3 additions & 1 deletion src/engine/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export const defaultSettings = {
send_delay: 0, // undo send delay in ms
pow_difficulty: 0,
muted_words: [],
ignore_muted_content: true,
hide_sensitive: true,
report_analytics: true,
min_wot_score: 0,
Expand Down Expand Up @@ -365,7 +366,8 @@ export const isEventMuted = withGetter(

const {roots, replies} = getReplyTagValues(e.tags)

if ([e.id, e.pubkey, ...roots, ...replies].some(x => $userMutes.has(x))) return true
if ([e.id, e.pubkey, ...roots, ...replies].some(x => x !== $pubkey && $userMutes.has(x)))
return true

if (regex) {
if (e.content?.toLowerCase().match(regex)) return true
Expand Down