Skip to content

Commit

Permalink
fix: don't show temp mutes on signed-in accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-ext committed Dec 12, 2023
1 parent 223457f commit 11164a4
Showing 1 changed file with 29 additions and 18 deletions.
47 changes: 29 additions & 18 deletions app/com/components/dialogs/MuteConfirmDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { type JSX, createSignal } from 'solid-js';
import { type JSX, createSignal, createMemo } from 'solid-js';

import { type InfiniteData, useQueryClient } from '@pkg/solid-query';

import type { RefOf } from '~/api/atp-schema.ts';
import { ListPurposeLabels } from '~/api/display.ts';
import { multiagent } from '~/api/globals/agent.ts';
import type { FilterPreferences } from '~/api/types.ts';

import { updateProfileMute } from '~/api/mutations/mute-profile.ts';
Expand Down Expand Up @@ -95,6 +96,10 @@ const renderMuteConfirmDialog = (profile: SignalizedProfile, filters: FilterPref

const [duration, setDuration] = createSignal('-1');

const isAccount = createMemo(() => {
return multiagent.accounts.some((account) => account.did === profile.did);
});

const handleConfirm = () => {
const uid = profile.uid;
const did = profile.did;
Expand Down Expand Up @@ -165,23 +170,29 @@ const renderMuteConfirmDialog = (profile: SignalizedProfile, filters: FilterPref
your posts and follow you.
</p>

<label>
<span class="mr-4 text-sm">Duration:</span>
<select
value={duration()}
onChange={(el) => setDuration(el.currentTarget.value)}
class={/* @once */ Select()}
>
<option value={-1}>Indefinite</option>
<option value={1 * 60 * 60 * 1_000}>1 hour</option>
<option value={6 * 60 * 60 * 1_000}>6 hour</option>
<option value={12 * 60 * 60 * 1_000}>12 hour</option>
<option value={1 * 24 * 60 * 60 * 1_000}>1 day</option>
<option value={3 * 24 * 60 * 60 * 1_000}>3 days</option>
<option value={7 * 24 * 60 * 60 * 1_000}>7 days</option>
<option value={14 * 24 * 60 * 60 * 1_000}>14 days</option>
</select>
</label>
{(() => {
if (!isAccount()) {
return (
<label>
<span class="mr-4 text-sm">Duration:</span>
<select
value={duration()}
onChange={(el) => setDuration(el.currentTarget.value)}
class={/* @once */ Select()}
>
<option value={-1}>Indefinite</option>
<option value={1 * 60 * 60 * 1_000}>1 hour</option>
<option value={6 * 60 * 60 * 1_000}>6 hour</option>
<option value={12 * 60 * 60 * 1_000}>12 hour</option>
<option value={1 * 24 * 60 * 60 * 1_000}>1 day</option>
<option value={3 * 24 * 60 * 60 * 1_000}>3 days</option>
<option value={7 * 24 * 60 * 60 * 1_000}>7 days</option>
<option value={14 * 24 * 60 * 60 * 1_000}>14 days</option>
</select>
</label>
);
}
})()}

{duration() !== '-1' ? (
<p class="text-sm text-muted-fg">
Expand Down

0 comments on commit 11164a4

Please sign in to comment.