mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-30 00:41:12 +00:00
Fix a few bugs
This commit is contained in:
parent
b0d02a41c2
commit
46d1c93a58
@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import cx from "classnames"
|
||||
import {randomId} from "hurdak"
|
||||
import {toggleTheme} from "src/partials/state"
|
||||
import MenuItem from "src/partials/MenuItem.svelte"
|
||||
@ -14,9 +13,9 @@
|
||||
import {
|
||||
env,
|
||||
user,
|
||||
pubkey,
|
||||
hasNewMessages,
|
||||
hasNewNotifications,
|
||||
pubkey,
|
||||
sessions,
|
||||
displayPerson,
|
||||
displayPubkey,
|
||||
@ -52,7 +51,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class={cx("fixed bottom-0 left-0 top-0 w-60 bg-cocoa transition-colors")}>
|
||||
<div class="fixed bottom-0 left-0 top-0 z-nav w-60 bg-cocoa transition-colors">
|
||||
<Anchor
|
||||
class="mb-4 flex h-16 items-center gap-1 px-6"
|
||||
external
|
||||
@ -154,7 +153,7 @@
|
||||
</MenuDesktopSecondary>
|
||||
{/if}
|
||||
<div class="cursor-pointer border-t border-solid border-mid px-7 pb-4 pt-3">
|
||||
{#if $user}
|
||||
{#if $pubkey}
|
||||
<Anchor class="flex items-center gap-2" on:click={() => setSubMenu("account")}>
|
||||
<PersonCircle class="h-10 w-10" pubkey={$pubkey} />
|
||||
<div class="flex min-w-0 flex-col">
|
||||
|
@ -179,19 +179,21 @@
|
||||
$: {
|
||||
actions = []
|
||||
|
||||
actions.push({label: "Quote", icon: "quote-left", onClick: quote})
|
||||
if ($canSign) {
|
||||
actions.push({label: "Quote", icon: "quote-left", onClick: quote})
|
||||
|
||||
if (!note.wrap && $env.ENABLE_GROUPS && ($groupOptions.length > 0 || address)) {
|
||||
actions.push({label: "Cross-post", icon: "shuffle", onClick: () => setView("cross-post")})
|
||||
}
|
||||
if (!note.wrap && $env.ENABLE_GROUPS && ($groupOptions.length > 0 || address)) {
|
||||
actions.push({label: "Cross-post", icon: "shuffle", onClick: () => setView("cross-post")})
|
||||
}
|
||||
|
||||
actions.push({label: "Tag", icon: "tag", onClick: label})
|
||||
//actions.push({label: "Report", icon: "triangle-exclamation", onClick: report})
|
||||
actions.push({label: "Tag", icon: "tag", onClick: label})
|
||||
//actions.push({label: "Report", icon: "triangle-exclamation", onClick: report})
|
||||
|
||||
if ($muted) {
|
||||
actions.push({label: "Unmute", icon: "microphone", onClick: unmuteNote})
|
||||
} else {
|
||||
actions.push({label: "Mute", icon: "microphone-slash", onClick: muteNote})
|
||||
if ($muted) {
|
||||
actions.push({label: "Unmute", icon: "microphone", onClick: unmuteNote})
|
||||
} else {
|
||||
actions.push({label: "Mute", icon: "microphone-slash", onClick: muteNote})
|
||||
}
|
||||
}
|
||||
|
||||
if ($env.FORCE_RELAYS.length === 0 && !note.wrap) {
|
||||
|
@ -24,6 +24,7 @@ import {
|
||||
deriveMembershipLevel,
|
||||
deriveAdminKeyForGroup,
|
||||
deriveSharedKeyForGroup,
|
||||
shouldPostPrivatelyToGroup,
|
||||
} from "./utils"
|
||||
|
||||
// Key state management
|
||||
@ -197,22 +198,10 @@ export const publishToZeroOrMoreGroups = async (
|
||||
return [await Publisher.publish({relays, event})]
|
||||
}
|
||||
|
||||
const [wrap, nowrap] = partition(a => {
|
||||
const access = deriveGroupAccess(a).get()
|
||||
const membershipLevel = deriveMembershipLevel(a).get()
|
||||
|
||||
if (membershipLevel === MembershipLevel.Private) {
|
||||
if (access === GroupAccess.Closed) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (access === GroupAccess.Hybrid) {
|
||||
return shouldWrap
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}, addresses)
|
||||
const [wrap, nowrap] = partition(
|
||||
address => shouldPostPrivatelyToGroup(address, shouldWrap),
|
||||
addresses,
|
||||
)
|
||||
|
||||
const pubs = []
|
||||
|
||||
|
@ -102,3 +102,20 @@ export const deriveMembershipLevel = address =>
|
||||
|
||||
return MembershipLevel.None
|
||||
})
|
||||
|
||||
export const shouldPostPrivatelyToGroup = (address, preference) => {
|
||||
const access = deriveGroupAccess(address).get()
|
||||
const membershipLevel = deriveMembershipLevel(address).get()
|
||||
|
||||
if (membershipLevel === MembershipLevel.Private) {
|
||||
if (access === GroupAccess.Closed) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (access === GroupAccess.Hybrid) {
|
||||
return preference
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ export const follow = (type: string, value: string) => {
|
||||
}
|
||||
|
||||
export const unfollow = (value: string) =>
|
||||
publishPetnames(reject((t: string[]) => t[1] === value, user.get().petnames || []))
|
||||
publishPetnames(reject((t: string[]) => t[1] === value, user.get()?.petnames || []))
|
||||
|
||||
export const publishMutes = ($mutes: string[][]) => {
|
||||
updateStore(people.key(stateKey.get()), now(), {mutes: $mutes})
|
||||
@ -37,9 +37,9 @@ export const publishMutes = ($mutes: string[][]) => {
|
||||
|
||||
export const mute = (type: string, pubkey: string) =>
|
||||
publishMutes([
|
||||
...reject((t: string[]) => t[1] === pubkey, user.get().mutes || []),
|
||||
...reject((t: string[]) => t[1] === pubkey, user.get()?.mutes || []),
|
||||
[type, pubkey],
|
||||
])
|
||||
|
||||
export const unmute = (value: string) =>
|
||||
publishMutes(reject((t: string[]) => t[1] === value, user.get().mutes || []))
|
||||
publishMutes(reject((t: string[]) => t[1] === value, user.get()?.mutes || []))
|
||||
|
@ -2,12 +2,14 @@ import {omit, assoc} from "ramda"
|
||||
import {generatePrivateKey, getPublicKey} from "nostr-tools"
|
||||
import {appDataKeys} from "src/util/nostr"
|
||||
import {createAndPublish} from "src/engine/network/utils"
|
||||
import {people} from "src/engine/people/state"
|
||||
import type {Session} from "./model"
|
||||
import {sessions, pubkey} from "./state"
|
||||
import {canSign, nip04, session} from "./derived"
|
||||
|
||||
const addSession = (s: Session) => {
|
||||
sessions.update(assoc(s.pubkey, s))
|
||||
people.key(s.pubkey).update($p => ({...$p, pubkey: s.pubkey}))
|
||||
pubkey.set(s.pubkey)
|
||||
}
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
export let small = false
|
||||
export let large = false
|
||||
|
||||
const className = cx('flex flex-col m-auto', $$props.class, {
|
||||
'gap-2': small,
|
||||
'gap-4': !small && !large,
|
||||
'gap-6': large,
|
||||
const className = cx("flex flex-col m-auto min-w-0 w-full", $$props.class, {
|
||||
"gap-2": small,
|
||||
"gap-4": !small && !large,
|
||||
"gap-6": large,
|
||||
})
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user