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 badges to all notification page tabs
- [x] Use better search algorithm and show loaded profiles in global search
- [x] Improve group invite deliverability
# 0.4.1

View File

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

View File

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

View File

@ -26,7 +26,7 @@
const scroller = createScroller(loadMore, {element: getModal()})
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}
})

View File

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