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

Fix usage of typing API #1088

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

Fix usage of typing API #1088

wants to merge 2 commits into from

Conversation

kroeckx
Copy link
Contributor

@kroeckx kroeckx commented Jul 21, 2021

  • Timeout is a required parameter when starting typing.
  • The typing parameter takes a bool not an integer.

Signed-off-by: Kurt Roeckx [email protected]

@richvdh
Copy link
Member

richvdh commented Jul 22, 2021

Please could you merge develop

- Timeout is a required parameter when starting typing.
- The typing parameter takes a bool not an integer.

Signed-off-by: Kurt Roeckx <[email protected]>
@kroeckx
Copy link
Contributor Author

kroeckx commented Jul 23, 2021

All the test suite errors look like bugs in Synapse and Dendrite.

@richvdh richvdh requested a review from a team July 26, 2021 13:37
@@ -19,3 +24,50 @@
Future->done(1);
});
};

test "PUT /rooms/:room_id/typing/:user_id without timeout fails",
Copy link
Member

Choose a reason for hiding this comment

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

what makes you think timeout is mandatory? https://spec.matrix.org/unstable/client-server-api/#put_matrixclientr0roomsroomidtypinguserid doesn't mark it as required.

Copy link
Member

Choose a reason for hiding this comment

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

re #1088 (comment): I don't agree with your interpretation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason I think it's required when typing is true are:

  • It says: If false, the timeout key can be omitted., which to me implies that it needs to be present when it's true.
  • It says This tells the server that the user is typing for the next N milliseconds where N is the value specified in the timeout key. That implies to me that we need to have a value.

Note that I'm not the only one interpreting it that way. If you think this is wrong, please fix the specifications. Adding a default value on the server side is easy enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So to clarify it more, those are the options:

typing timeout
true present
true not present
false present
false not present

The can be omitted to me means that both the 3rd and 4th option are valid. Without the sentence, option 3 and 4 are also valid. But since the sentence is there, to me it says that if it's true you can not omit it.

Comment on lines 50 to 73
test "PUT /rooms/:room_id/typing/:user_id with invalid json fails",
requires => [ local_user_and_room_fixtures() ],

proves => [qw( can_set_room_typing )],

do => sub {
my ( $user, $room_id ) = @_;

do_request_json_for( $user,
method => "PUT",
uri => "/r0/rooms/$room_id/typing/:user_id",

content => {
typing => 1,
timeout => 30000,
},
)->main::expect_http_400()
->then( sub {
my ( $response ) = @_;
my $body = decode_json( $response->content );
assert_eq( $body->{errcode}, "M_BAD_JSON", 'responsecode' );
Future->done( 1 );
});
};
Copy link
Member

Choose a reason for hiding this comment

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

this looks good, but we can't really merge it until synapse (and preferably dendrite, if it has the same problem) are fixed. Any chance you could raise issues against those projects?

@kroeckx
Copy link
Contributor Author

kroeckx commented Jul 28, 2021 via email

@richvdh
Copy link
Member

richvdh commented Aug 9, 2021

blocked by matrix-org/synapse#10497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants