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

Fix underlying logic with adding presenters. #305

Conversation

unsay
Copy link
Contributor

@unsay unsay commented Apr 13, 2024

When adding presenters, the JavaScript library does not pass the unique ID, but the person's name to the server. The server then does a lookup using the name, returning the first result.

def create
# super lame: look up the person by name. Twitter's typeahead library doesn't currently have a way to report an item's been selected.
participant = Participant.where(:name => params[:name]).first

I don't know PostgreSQL's internals well; though I suspect it will return the lowest ID (i.e. oldest account) -- meaning people with duplicate accounts will probably "never accept the CoC".

Resolution

I don't want to yak-shave the Rails Asset Pipeline, so I'm linking to a CDN with a POJO autocomplete library.

This fixes an issue so at least the person selected does not break the application. Further discussion in #300 to address duplicate names.

refs #300
closes #304
closes #265
closes #264
refs #120
closes #261 (winning)

Copy link
Contributor

@experimatt experimatt left a comment

Choose a reason for hiding this comment

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

This looks good to me, although I'm concerned about linking directly to the cdn for autoComplete.js. I'd feel better if it were saved in the repo somewhere (as a node module?), but that might be a larger strategic discussion.

@unsay
Copy link
Contributor Author

unsay commented Apr 24, 2024

In general, I agree, we don't gain much from a CDN for the libs/resources we have. It does, however, lower management/maintenance surface area for the Rails Asset Pipeline (albeit requiring a network connection for development).

Given Rails 5.2 was EOL June 2022 and Ruby 2.7 was EOL March 2023, I think focusing on those then bringing the JS libs in-line with the current JS/Rails model is where we might want to spend some effort.

@unsay
Copy link
Contributor Author

unsay commented Apr 24, 2024

@experimatt I will change the referenced library to include the SRI hash, which may be enough to securely pin in while we address the larger discussion.

@unsay
Copy link
Contributor Author

unsay commented Jun 9, 2024

@experimatt Good to go.

Copy link
Contributor

@experimatt experimatt left a comment

Choose a reason for hiding this comment

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

Looks good!

@experimatt experimatt merged commit 934ebbd into minnestar:master Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants