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

Recording anonymous users and sending notifications #1

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

Conversation

gjaldon
Copy link

@gjaldon gjaldon commented Sep 15, 2016

Most of the explanations are in the commits but there some comments to explain some of the code that may be unclear.

We want to start recording anonymous users so we can store
relevant data such as a fake name, fake avatar, and when
their chatroom was last viewed by an admin.

We generate the relevant migrations and add the fields we
need for an `anonymous_user`. Since the frontend generates
a UUID for every anonymous user, the UUID would be perfect as
`id` for our AnonymousUser records. We use the `uuid` type
for the `id` column of our AnonymousUser and set it to
not autogenerate an id. That way, we use the UUID passed to
us from the frontend as `id` every time we create a new
AnonymousUser record.

Now that we have an AnonymousUser, we can associate it with
Message so we can easily get all the messages sent by a user.
Note that there are a few extra steps for this because we
are using a `:uuid` type as `id` instead of the default
`:integer`.
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.

1 participant