Skip to content

Commit

Permalink
Fix issue where ownerships weren't listed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
DinerIsmail committed Oct 15, 2023
1 parent b3db4a2 commit 0bd52af
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
11 changes: 9 additions & 2 deletions components/homepage/web-cards/WebCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ const WebCards = () => {
{webs
?.filter(
(web) =>
web.published && Boolean(web.image) && web.slug !== 'ctrlshift',
web.published &&
Boolean(web.image) &&
web.slug !== 'ctrlshift' &&
web.slug !== 'transition',
)
.sort((a, b) => {
if (orderOnHomepage.includes(a.title) > orderOnHomepage.includes(b.title)) {
if (
orderOnHomepage.includes(a.title) >
orderOnHomepage.includes(b.title)
) {
return -1
} else {
return 1
Expand Down Expand Up @@ -97,3 +103,4 @@ const Card = ({ web }) => {




7 changes: 6 additions & 1 deletion components/nav/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ export default function MainNav() {
label: 'Webs',
href: '#',
children: webs
?.filter((web) => web.published && web.slug !== 'ctrlshift')
?.filter(
(web) =>
web.published &&
web.slug !== 'ctrlshift' &&
web.slug !== 'transition',
)
.map((web) => ({
label: web.title,
href: `${PROTOCOL}://${web.slug}.${REMOTE_HOSTNAME}`,
Expand Down
2 changes: 1 addition & 1 deletion pages/admin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Admin = () => {

if (permissions?.webIds?.includes(selectedWebId)) return listings

return listings.filter((listing) => {
return listings?.filter((listing) => {
return permissions?.listingIds?.includes(listing.id)
})
}, [
Expand Down
26 changes: 14 additions & 12 deletions pages/admin/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
} from '@chakra-ui/react'
import { signIn, useSession } from 'next-auth/react'
import LayoutContainer from '@components/admin/layout-container'
import PermissionsList from '@components/admin/permissions-list'
// import PermissionsList from '@components/admin/permissions-list'
import PermissionsTable from '@components/admin/permissions-table'
import { useListings } from '@hooks/listings'
import { emailRequiredValidator } from '@helpers/formValidation'
Expand Down Expand Up @@ -77,7 +77,9 @@ export default function Invite() {
return []
}

return ownerships.map((ownership) => ({ ...ownership, owner: true }))
return ownerships
.filter((ownership) => !ownership.user.admin)
.map((ownership) => ({ ...ownership, owner: true }))
}, [ownerships])

const permissionsForCurrentWebWithoutOwners = useMemo(() => {
Expand Down Expand Up @@ -305,7 +307,7 @@ export default function Invite() {
id="web"
onChange={field.onChange}
>
Give full access to the{' '}
Give Editor access to the{' '}
<strong>{selectedWebName}</strong> web
</Checkbox>
<FormErrorMessage>
Expand Down Expand Up @@ -348,16 +350,16 @@ export default function Invite() {
List of people who have permissions to edit some or all the
listings on the <b>{selectedWebName}</b> web.
</Text>
{isOwnerOfCurrentWeb ? (
{/* {isOwnerOfCurrentWeb ? (
<PermissionsList permissions={permissionsForCurrentWeb} />
) : (
<PermissionsTable
permissions={[
...decoratedOwnerships,
...permissionsForCurrentWebWithoutOwners,
]}
/>
)}
) : ( */}
<PermissionsTable
permissions={[
...decoratedOwnerships,
...permissionsForCurrentWebWithoutOwners,
]}
/>
{/* )} */}
</Box>
)}
</Stack>
Expand Down

1 comment on commit 0bd52af

@vercel
Copy link

@vercel vercel bot commented on 0bd52af Oct 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.