-
Notifications
You must be signed in to change notification settings - Fork 56
Integration of Chatkit #406
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
Conversation
…of Chatkit's server failure. Untested.
Pull Request Test Coverage Report for Build 2513
💛 - Coveralls |
geshuming
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, first thing I noticed is that there isn't a lot of tests...
Can we get some tests written so we can at least understand how to approach and use your features.
@geshuming There are no tests at the moment! They will be included once I figure out how ExVCR works. I'll ping the group once they are complete and ready for merging! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some preliminary comments.
I realised that you are reusing the comment field from answer. Can we deprecate the comment field instead, and add a new field for the chat room token.
Since the frontend no longer requires avengers to write grading comments, the frontend should send null or empty string for the comment, and we can further guard the field here by having it default to empty string, or be nullable in the database. Regardless, we can keep the comment field but mark it as deprecated.
geshuming
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, looks better! We need a couple more optimizations, otherwise it will be good to go.
geshuming
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to check if a room key is valid? Currently it seems that we assume that comment is either nil or VALID_KEY
|
|
||
| if answer.comment == "" or answer.comment == nil do | ||
| Room.create_rooms(submission, answer, user) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, can this be placed where a submission occurs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I clarify what you mean? Do you mean when a submission is being finalised?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I think it is fine to leave the function here for now. But ultimately room creation should be done when a submission is submitted right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I'll place it here then? Since this is where all submissions flow through, whether it's submitted early or submitted by the autograder. Quite ugly tho :/
rrtheonlyone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for spam, I just have some other comments here:
-
"admin" seems to be hardcoded for
get_superuser_token-> possible to make it a constant/variable (minor nit) -
It is interesting that you are tagging each user with their
user_idwhen creating. This is the primary key in the database. This means that the user ids will just be ["1", "2", "3"] and so on.
I believe this is brittle and can lead to errors. Consider a scenario in which the import script adds half of the users and breaks after that. Or if there is a change to one/two users in between. We then have to manually go into chatkit and cleanup the ids. However, this is unlikely to happen as the User table does not usually change over the semester and remains constant (its more of a what if..)
I prefer to use the NUS ID instead to create Users. This is just a suggestion/concern. @geshuming @flxffy do see if you want to change or not!
@rrtheonlyone It should be fine. Many other core components also use |
@geshuming The only way to verify a room id's validity is through a GET request to Chatkit to fetch room info. There's no documentation on how the room ids are being generated either. |
@rrtheonlyone I used |
|
Tests have been added for room creation. |
geshuming
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok. I will log issues from this PR
Backend to supplement the usage of ChatKit. API can be found here.
What's new:
lib/cadet/chat/token.ex: generate tokens for connection to Chatkit's serviceslib/cadet/chat/room.ex: logic for creating rooms using Chatkit's API and storing room id in the db2.1 Updated router to enable frontend retrieval of a token - for Chatkit's TokenProvider in the frontend
mix/tasks/users/chat.ex: logic for creating users on ChatkitCurrent Implementation:
commentcolumn in the Answer table to store room idsTests for Chatkit will be included by the end of the week once I figure out how ExVCR works 👯