You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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;
The text was updated successfully, but these errors were encountered:
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;
The text was updated successfully, but these errors were encountered: