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

Adjust auto-tagging #305

Merged
merged 3 commits into from
Apr 19, 2024
Merged

Adjust auto-tagging #305

merged 3 commits into from
Apr 19, 2024

Conversation

zuuring
Copy link
Member

@zuuring zuuring commented Apr 17, 2024

Notes

This PR removes the custom channel auto-tagging for #hiring channel while also some refactoring in order to account for empty arrays better, since before it relied on at least one entry there at all times.

### Notes
This PR removes the custom channel auto-tagging for `#hiring` channel while also some refactoring in order to account for empty arrays better, since before it relied on at least one entry there at all times.
Copy link
Contributor

@Shadowfiend Shadowfiend left a comment

Choose a reason for hiding this comment

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

Left a few notes/questions.

discord-scripts/thread-management/auto-join.ts Outdated Show resolved Hide resolved
discord-scripts/thread-management/auto-join.ts Outdated Show resolved Hide resolved
discord-scripts/thread-management/auto-join.ts Outdated Show resolved Hide resolved
discord-scripts/thread-management/auto-join.ts Outdated Show resolved Hide resolved
zuuring and others added 2 commits April 19, 2024 10:13
This commits fixes up the `auto-join.ts` in favor of mapping, along with refactoring everything to make it smoother.
@zuuring
Copy link
Member Author

zuuring commented Apr 19, 2024

@Shadowfiend Just pushed a update with this feedback! Now it's much cleaner and switched interface in favor of Record<string, string>.

Copy link
Contributor

@Shadowfiend Shadowfiend left a comment

Choose a reason for hiding this comment

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

Lgtm, let's :shipit:

@@ -23,7 +23,11 @@ import {
// it to mention the right role. Discord's behavior in this scenario is not to
// ping the role, but to add all its members to the thread.

const CUSTOM_CHANNEL_ROLE = [{ channelName: "hiring", roleName: "PeopleOps" }]
const CUSTOM_CHANNEL_ROLE: Record<string, string> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Fwiw the one downside of Record<string, string> is that it removes our ability to name either string. Whereas we could do:

const CUSTOM_ROLE_TAG_BY_CHANNEL: { [channelName: string]: string } = {
  ...
}

Mostly academic, but useful to know :) channelName here does nothing other than provide a hint to the programmer as to what the key of the object is meant to be.

if (channelMatchingRole) {
await placeholder.edit(channelMatchingRole.toString())
return
if (hasCustomChannels && containingChannel) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The way this control flows, we don't even need hasCustomChannels—if there are no custom channels, roleName will never pass if (roleName), and we'll continue to the following components.

@Shadowfiend Shadowfiend merged commit 2a55dbe into main Apr 19, 2024
7 checks passed
@Shadowfiend Shadowfiend deleted the auto-tagging-fix branch April 19, 2024 18:19
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.

2 participants