Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Only use the ts parameter for e.g. /send for appservices #3333

Open
S7evinK opened this issue Feb 20, 2024 · 0 comments
Open

Only use the ts parameter for e.g. /send for appservices #3333

S7evinK opened this issue Feb 20, 2024 · 0 comments
Labels
C-App-Services good first issue Want to help with Dendrite? These are the issues to start with!

Comments

@S7evinK
Copy link
Contributor

S7evinK commented Feb 20, 2024

Only use the ts parameter e.g.

evTime, err := httputil.ParseTSParam(req)
for appservices, similar to what Synapse is doing.

@S7evinK S7evinK added good first issue Want to help with Dendrite? These are the issues to start with! C-App-Services labels Feb 20, 2024
AllMightLegend added a commit to AllMightLegend/dendrite that referenced this issue Aug 16, 2024
The issue involved ensuring that the ts parameter in Dendrite is correctly handled when the request is from an appservice, and that it is ignored or handled differently when not. The resolution was achieved through the following steps:

Refactoring the Logic:
The logic for processing the ts parameter was refactored into a separate function named HandleEventTimestamp. This function determines whether the request is from an appservice by calling isAppService(req). If it is, the function parses the ts parameter using httputil.ParseTSParam(req). If the request is not from an appservice, the function defaults to using the current time or another appropriate handling.

Updating sendevent.go:
The inline logic in sendevent.go that handled the ts parameter was replaced with a call to the new HandleEventTimestamp function. This ensures that the logic is centralized and can be easily tested and maintained.

Creating Tests:
A new test file, ts_param_test.go, was created in the testing directory. This file includes tests that cover various scenarios:

When the ts parameter is valid and the request is from an appservice.
When the ts parameter is invalid or missing.
When the request is not from an appservice.

Signed off by : `Srinjoy Sen Chowdhury [email protected]`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C-App-Services good first issue Want to help with Dendrite? These are the issues to start with!
Projects
None yet
Development

No branches or pull requests

1 participant