Created
February 27, 2020 14:47
-
-
Save gregblake/d2fb68395dc0bd87e1eb32b8b86ed283 to your computer and use it in GitHub Desktop.
Connect::Message.with_context documentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Connect::Message.with_context | |
| returns a message, and a number of messages that preceed and succeed it, in the same conversation | |
| public rooms | |
| behaves like a conversation that the user has access to | |
| when the preceding & succeeding message count are less than the number of messages in the convo | |
| returns the selected msg, along with the correct # of messages, to provide context for the messsage | |
| when the combined preceding & succeeding message counts are greater than the # of msgs in the convo | |
| returns the selected msg, along with every other message in the conversation | |
| when the preceding_message_count is zero | |
| returns 0 preceeding msgs, the selected msg, & the correct number of succeeding messages in the convo | |
| when the succeeding_message_count is zero | |
| returns the correct number of succeeding messages, the selected msg, & 0 succeeding messages | |
| when the preceding_message_count and succeeding_message_count are nil | |
| returns *only* the target message, with 0 preceding/succeeding messages in the conversation | |
| when no message can be found via the selected_message_id | |
| raises an ActiveRecord::RecordNotFound error | |
| private rooms | |
| when the user has access to the private room | |
| behaves like a conversation that the user has access to | |
| when the preceding & succeeding message count are less than the number of messages in the convo | |
| returns the selected msg, along with the correct # of messages, to provide context for the messsage | |
| when the combined preceding & succeeding message counts are greater than the # of msgs in the convo | |
| returns the selected msg, along with every other message in the conversation | |
| when the preceding_message_count is zero | |
| returns 0 preceeding msgs, the selected msg, & the correct number of succeeding messages in the convo | |
| when the succeeding_message_count is zero | |
| returns the correct number of succeeding messages, the selected msg, & 0 succeeding messages | |
| when the preceding_message_count and succeeding_message_count are nil | |
| returns *only* the target message, with 0 preceding/succeeding messages in the conversation | |
| when no message can be found via the selected_message_id | |
| raises an ActiveRecord::RecordNotFound error | |
| when the user does *NOT* have access to the given conversation | |
| behaves like a conversation that the user does *NOT* have access to | |
| and the before & after limit are equal to the messages in the room | |
| raises a Connect::Message::PermissionDenied error | |
| when the message doesn't exist | |
| raises an ActiveRecord::RecordNotFound error | |
| one-on-one conversations | |
| when the user has access to the given conversation | |
| behaves like a conversation that the user has access to | |
| when the preceding & succeeding message count are less than the number of messages in the convo | |
| returns the selected msg, along with the correct # of messages, to provide context for the messsage | |
| when the combined preceding & succeeding message counts are greater than the # of msgs in the convo | |
| returns the selected msg, along with every other message in the conversation | |
| when the preceding_message_count is zero | |
| returns 0 preceeding msgs, the selected msg, & the correct number of succeeding messages in the convo | |
| when the succeeding_message_count is zero | |
| returns the correct number of succeeding messages, the selected msg, & 0 succeeding messages | |
| when the preceding_message_count and succeeding_message_count are nil | |
| returns *only* the target message, with 0 preceding/succeeding messages in the conversation | |
| when no message can be found via the selected_message_id | |
| raises an ActiveRecord::RecordNotFound error | |
| when the user does *NOT* have access to the given conversation | |
| behaves like a conversation that the user does *NOT* have access to | |
| and the before & after limit are equal to the messages in the room | |
| raises a Connect::Message::PermissionDenied error | |
| when the message doesn't exist | |
| raises an ActiveRecord::RecordNotFound error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment