Improve group invite deliverability

This commit is contained in:
Jon Staab 2024-02-02 09:59:15 -08:00
parent 06df31a885
commit 8bbe09b4b1
5 changed files with 17 additions and 8 deletions

View File

@ -6,6 +6,7 @@
- [x] Add group notes to group notifications - [x] Add group notes to group notifications
- [x] Add badges to all notification page tabs - [x] Add badges to all notification page tabs
- [x] Use better search algorithm and show loaded profiles in global search - [x] Use better search algorithm and show loaded profiles in global search
- [x] Improve group invite deliverability
# 0.4.1 # 0.4.1

View File

@ -7,7 +7,7 @@
import GroupCircle from "src/app/shared/GroupCircle.svelte" import GroupCircle from "src/app/shared/GroupCircle.svelte"
import GroupName from "src/app/shared/GroupName.svelte" import GroupName from "src/app/shared/GroupName.svelte"
import PersonBadgeSmall from "src/app/shared/PersonBadgeSmall.svelte" import PersonBadgeSmall from "src/app/shared/PersonBadgeSmall.svelte"
import {groupRequests} from "src/engine" import {groupRequests, loadPubkeys} from "src/engine"
import {router} from "src/app/router" import {router} from "src/app/router"
export let address export let address
@ -36,6 +36,8 @@
.open() .open()
} }
} }
loadPubkeys([request.pubkey])
</script> </script>
<Card interactive> <Card interactive>

View File

@ -3,22 +3,24 @@
import Anchor from "src/partials/Anchor.svelte" import Anchor from "src/partials/Anchor.svelte"
import PersonCircle from "src/app/shared/PersonCircle.svelte" import PersonCircle from "src/app/shared/PersonCircle.svelte"
import {router} from "src/app/router" import {router} from "src/app/router"
import {displayPubkey} from "src/engine" import {derivePerson, displayPerson} from "src/engine"
export let pubkey export let pubkey
export let inert = false export let inert = false
const person = derivePerson(pubkey)
</script> </script>
{#if inert} {#if inert}
<span class={cx($$props.class, "relative z-feature flex items-center gap-2")}> <span class={cx($$props.class, "relative z-feature flex items-center gap-2")}>
<PersonCircle {pubkey} /> <PersonCircle {pubkey} />
<span>{displayPubkey(pubkey)}</span> <span>{displayPerson($person)}</span>
</span> </span>
{:else} {:else}
<Anchor <Anchor
href={router.at("people").of(pubkey).toString()} href={router.at("people").of(pubkey).toString()}
class={cx($$props.class, "relative z-feature flex items-center gap-2")}> class={cx($$props.class, "relative z-feature flex items-center gap-2")}>
<PersonCircle {pubkey} /> <PersonCircle {pubkey} />
<span>{displayPubkey(pubkey)}</span> <span>{displayPerson($person)}</span>
</Anchor> </Anchor>
{/if} {/if}

View File

@ -26,7 +26,7 @@
const scroller = createScroller(loadMore, {element: getModal()}) const scroller = createScroller(loadMore, {element: getModal()})
const groupList = derived([groups, session], ([$groups, $session]) => { const groupList = derived([groups, session], ([$groups, $session]) => {
const [joined, other] = partition(g => deriveIsGroupMember(g.address).get(), $groups) const [joined, other] = partition(g => deriveIsGroupMember(g.address, true).get(), $groups)
return {joined, other} return {joined, other}
}) })

View File

@ -94,7 +94,7 @@ export const getGroupStatus = (session, address) =>
export const deriveGroupStatus = address => export const deriveGroupStatus = address =>
session.derived($session => getGroupStatus($session, address)) session.derived($session => getGroupStatus($session, address))
export const getIsGroupMember = (session, address) => { export const getIsGroupMember = (session, address, includeRequests = false) => {
const status = getGroupStatus(session, address) const status = getGroupStatus(session, address)
if (address.startsWith("34550:")) { if (address.startsWith("34550:")) {
@ -102,14 +102,18 @@ export const getIsGroupMember = (session, address) => {
} }
if (address.startsWith("35834:")) { if (address.startsWith("35834:")) {
if (includeRequests && status.access === GroupAccess.Requested) {
return true
}
return status.access === GroupAccess.Granted return status.access === GroupAccess.Granted
} }
return false return false
} }
export const deriveIsGroupMember = address => export const deriveIsGroupMember = (address, includeRequests = false) =>
session.derived($session => getIsGroupMember($session, address)) session.derived($session => getIsGroupMember($session, address, includeRequests))
export const deriveGroupOptions = (defaultGroups = []) => export const deriveGroupOptions = (defaultGroups = []) =>
session.derived($session => { session.derived($session => {