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

Add message field to quote model #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

dbrgn
Copy link
Contributor

@dbrgn dbrgn commented Jan 27, 2020

The message needs to be embedded, since the webclient might not have received that message yet.

@dbrgn dbrgn added the enhancement New feature or request label Jan 27, 2020
@dbrgn dbrgn requested a review from lgrahl January 27, 2020 15:39
Copy link
Contributor

@lgrahl lgrahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion inline.

The quoted message

This should always be provided if a message ID is specified, unless the
app cannot find the message in its database.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to add:

This MUST NOT be a message containing a quote!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as quotes aren't resolved recursively, there should be little harm in doing so. I think it's better if Threema Web is written in a robust way that can handle this, versus having to trust that the app doesn't have any validation bug.

Copy link
Contributor

@lgrahl lgrahl Jan 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. It is not allowed to have a quote within a quote. Furthermore, a MUST does not make validation redundant. On the contrary, it makes the reader aware of it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think the recursive resolving is a very easy mistake to make.

@lgrahl
Copy link
Contributor

lgrahl commented Jan 28, 2020

Also, have you checked for side effects? This model is being used throughout a couple of other messages and I'm not sure it makes a lot of sense in all of them.

@dbrgn
Copy link
Contributor Author

dbrgn commented Jan 28, 2020

Also, have you checked for side effects? This model is being used throughout a couple of other messages and I'm not sure it makes a lot of sense in all of them.

What type of side effects would you expect? All new fields are optional, so the protocol change itself will not break anything, unless it's explicitly handled.

You're right though that creating a quote and retrieving a quote could use separate types (Quote and NewQuote, since when creating a quote the remote client would not send along the message, only the message ID). The downside of a separate type would be that we lose backwards compatibility (since the NewQuote type would probably not include the quoted text).

@dbrgn
Copy link
Contributor Author

dbrgn commented Jan 28, 2020

@lgrahl I added some additional notes regarding validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants