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

Use wall system for private messages #21

Open
loolmeh opened this issue Feb 17, 2014 · 0 comments
Open

Use wall system for private messages #21

loolmeh opened this issue Feb 17, 2014 · 0 comments

Comments

@loolmeh
Copy link

loolmeh commented Feb 17, 2014

It's a bit annoying to use the private messages right now because it won't display a whole conversation but only the messages one by one. We can probably use the wall system when creating a private message, and then the inbox would be a list of threads instead of a list of messages. The "inbox" (in menu) should probably be renamed to "messages". The "sent" folder will not be needed anymore.I think can work if we add just a table : users_wall (user_id, wall_id, is_read).The pair (user_id, wall_id) would indicate who can read which thread. We can set user_id to null for public threads on the wall.Whenever someone starts a thread, an entry in the wall is created (the wall table has a field named "title" which is not used yet, but can be use for the private messages). Then two entries in the users_wall are created. One that says I can read the thread I've just created, and another one that says the recipient can read it too (and for him, the is_read field will be set to false).Whenever someone replies, we don't add another entry in users_wall. We just set the is_read value to false for the recipient. The entry added to the wall table will always have the replyTo set to the id of the first message of the thread. There's no need to have more than one level of replies.To retrieve the threads of a user and list them on the private messages page :SELECT * FROM users_wall JOIN wall ON wall.id = users_wall.wall_id WHERE user_id = $user_id.It will be easy to check whether the user has read all the messages of the threads or not with the is_read attribute.To retrieve the messages of a thread :SELECT * FROM wall WHERE wall.id = $id OR wall.replyTo = $id ORDER BY created;

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

No branches or pull requests

1 participant