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

first cut at keyword subscriptions #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rhendric
Copy link
Collaborator

@rhendric rhendric commented Jan 9, 2024

Things I'd work on if I didn't want to keep this as small as possible for you:

  • Giving the bot some subscribe/unsubscribe commands, instead of having to go through Herring's interface
  • Figure out if there's a better interaction model than the high-five, which doesn't work quite as well in DMs as it does in the puzzle announcement channel due to documented Discord limitations
  • Be smarter about keywords so that they could support short phrases and not just single words

But I'm pretty jazzed about this anyway and I hope you get a chance to take a look.

@rhendric rhendric force-pushed the rhendric/subscriptions branch from cecad89 to 8125b02 Compare January 9, 2024 10:42
Copy link
Owner

@gwillen gwillen left a comment

Choose a reason for hiding this comment

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

Looks generally good to me, see comments.

from django.db import migrations, models


class Migration(migrations.Migration):
Copy link
Owner

Choose a reason for hiding this comment

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

You will need to remove this migration from your PR -- I have not found a way to get Django to stop generating it. It happens because we set the default value of the hunt_id field based on an environment variable that we change every year. (Some better way of configuring that is obviously on the todo list but it's not really a practical necessity.) Even though the default value is always supplied explicitly by Django, and the database field's own default value is never used, Django still really really wants to create a migration to irrelevantly change the database's default value.

if instance.tags != instance.tracker.previous('tags') and instance.tracker.previous('tags') is not None:
post_update.delay(instance.slug, 'tags', instance.tags)
old_keywords.update(re.findall('\w+', instance.tracker.previous('tags').lower()))
Copy link
Owner

Choose a reason for hiding this comment

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

Technically you are ignoring the fact that tags are supposed to be a list, and treating them as a bag of words. I don't strenuously object to that, but I figured I'd note it. (I think probably in fact they should be stored more cleverly than a comma-separated string in the database, but that's where we currently are.)

]

operations = [
migrations.AddField(
Copy link
Owner

Choose a reason for hiding this comment

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

What is the expected format of the field? It looks like either space-separated or comma-separated might work ok?

@@ -230,6 +230,30 @@ async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
target_channel = message.channel_mentions[0]
await self.add_user_to_puzzle(payload.member, target_channel.name)

# TODO: Merge this with the above when not in ultra-conservative mode
Copy link
Owner

Choose a reason for hiding this comment

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

Go ahead and merge it, and eliminate the requirement that it be the bot's message while you're at it? (Per separate discussion about this being a desirable feature.) So that just any SIGNUP_EMOJI react, to any message the bot can see that mentions a puzzle channel, counts.

Copy link
Owner

Choose a reason for hiding this comment

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

Oh sorry, this is what Paul already fixed in #91. Rebase on top of that instead, presumably.


// Possibly this should apply to all labels, but trying to be
// ultra-conservative right now
label[for="id_subscriptions"] {
Copy link
Owner

Choose a reason for hiding this comment

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

Does this literally only affect the visual appearance of the admin form? Or what is this restyling? If it's just the admin form, I don't care as long as it still works, make it pretty however you want. But I'm actually confused about why it's necessary -- the admin form appears to be styled fine to me, with labels at the top, and if I try adding this style to one of them for testing, it totally breaks the page...

Copy link
Owner

Choose a reason for hiding this comment

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

Ohhh, the admin and non-admin default forms share the exact same property for this. Amazing. I think if you apply this it might break the admin form, I'm not sure. Presumably there's some intended way to style just the user-side form...

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