Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ Catfishes know about other catfishes #264

Open
wants to merge 13 commits into
base: development
Choose a base branch
from

Conversation

gchamb
Copy link
Member

@gchamb gchamb commented Dec 31, 2022

  • catfishes know about each other when roles are displayed
  • highlight name in red in matched name if they're both catfishes
  • highlight name in red for other catfishes in vote if they're a catfish

@gchamb gchamb linked an issue Dec 31, 2022 that may be closed by this pull request
3 tasks
@gchamb gchamb requested a review from a team December 31, 2022 23:05
client/src/components/ReceiveRole.svelte Outdated Show resolved Hide resolved
client/src/components/Vote.svelte Outdated Show resolved Hide resolved
allow get: if request.auth.uid == uid;
allow list: if isCatfish() && isCatfishResource();
Copy link
Member

Choose a reason for hiding this comment

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

do we really want catfish to be able to read the entire privatePlayer document?

Copy link
Member Author

Choose a reason for hiding this comment

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

They're only allowed to read other catfish private player docs in which only holds the their role(which we want them to know), stalker(wouldn't matter if they know because they're working together), and prompt in which they would have the same prompt.

Copy link
Member

Choose a reason for hiding this comment

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

hmm I guess so but it feels wrong

Copy link
Member Author

Choose a reason for hiding this comment

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

If you have a better idea lmk. We'd be only duplicating a little bit of data if you do have one

client/src/routes/game/+page.svelte Outdated Show resolved Hide resolved
@@ -156,6 +163,25 @@
}
}
}

$: privatePlayer, getCatfishes();
function getCatfishes() {
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we call unsubscribeCatfishes here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I understand but explain why?

Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure the way the code is currently written we resubscribe every time the private player changes (each time there is a new prompt for example) but we never unsubscribe so that will put a lot of unwanted stress on the database.

Copy link
Member

Choose a reason for hiding this comment

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

why is unsubscribeCatfishes not called if the state is ROLE?

Copy link
Member Author

Choose a reason for hiding this comment

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

So you saying subscribe for that moment then unsubscribe? And a side note I think the getDocs function might be better since we're not using the newly updated documents to display to the user or anything

Copy link
Member

Choose a reason for hiding this comment

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

No I'm saying unsubscribe before you subscribe

Copy link
Member

Choose a reason for hiding this comment

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

Yeah getDocs makes sense to me

Copy link
Member Author

Choose a reason for hiding this comment

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

No I'm saying unsubscribe before you subscribe
Yeah, that makes sense. You want to make sure you unsubscribe from the previous subscription before you subscribe again in the Role phases case.

Comment on lines 34 to 36
if (catfishes == undefined) {
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

is this if still needed?

@@ -60,7 +61,9 @@
on:click={() => vote(lobby.uids[i])}
>
<AvatarImg {avatar} />
<span class="mdc-typography--subtitle1">{displayName ?? ""}</span>
<span class="mdc-typography--subtitle1 " class:catfish={catfishes.includes(lobby.uids[i])}
>{displayName ?? ""}</span
Copy link
Member

@nstringham nstringham Jan 10, 2023

Choose a reason for hiding this comment

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

personally I like this

<span>
  text
</span>

more than this

<span
>text</span
>

@@ -60,7 +61,9 @@
on:click={() => vote(lobby.uids[i])}
>
<AvatarImg {avatar} />
<span class="mdc-typography--subtitle1">{displayName ?? ""}</span>
<span class="mdc-typography--subtitle1 " class:catfish={catfishes.includes(lobby.uids[i])}
Copy link
Member

Choose a reason for hiding this comment

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

you acedentaly added space in the class

@@ -156,6 +163,25 @@
}
}
}

$: privatePlayer, getCatfishes();
function getCatfishes() {
Copy link
Member

Choose a reason for hiding this comment

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

why is unsubscribeCatfishes not called if the state is ROLE?

Comment on lines 37 to 39
.catfish {
color: #d32f2f;
}
Copy link
Member

Choose a reason for hiding this comment

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

this code is duplicated in ReceiveRole maybe it would be best to move all three role colors into the theme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Catfishes know other catfish
2 participants