dendrite/clientapi/routing
Srinjoy Sen Chowdhury 35611c476f #3333 used ts parameter for appservices
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 srinjoysen123@gmail.com`
2024-08-16 18:43:44 +05:30
..
account_data.go Cleanup remaining statekey usage for senderIDs (#3106) 2023-06-12 11:19:25 +00:00
admin.go Fix: Edited messages appear twice in fulltext search (#3363) 2024-07-27 22:30:17 +02:00
admin_whois.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
aliases.go Cleanup remaining statekey usage for senderIDs (#3106) 2023-06-12 11:19:25 +00:00
auth_fallback.go Add clientapi tests (#2916) 2022-12-23 14:11:11 +01:00
auth_fallback_test.go Remove BaseDendrite (#3023) 2023-03-22 09:21:32 +01:00
capabilities.go Add config key for default room version (#3171) 2023-08-08 14:20:05 +01:00
createroom.go Add config key for default room version (#3171) 2023-08-08 14:20:05 +01:00
deactivate.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
device.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
directory.go Return M_INVALID_PARAM instead of M_BAD_JSON when setting aliases (#3297) 2024-01-09 20:05:45 +01:00
directory_public.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
directory_public_test.go refactor: use latest GMSL which splits fed client from matrix room logic (#3051) 2023-04-06 09:55:01 +01:00
joined_rooms.go [pseudoID] More pseudo ID fixes (#3167) 2023-08-15 12:37:04 +01:00
joinroom.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
joinroom_test.go Use IsBlacklistedOrBackingOff to determine if we should try to fetch devices (#3254) 2023-11-09 08:43:27 +01:00
key_backup.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
key_crosssigning.go Move json errors over to gmsl (#3080) 2023-05-09 22:46:49 +00:00
keys.go Remove unused token (#3331) 2024-02-19 19:19:06 +00:00
leaveroom.go Cleanup remaining statekey usage for senderIDs (#3106) 2023-06-12 11:19:25 +00:00
login.go Appservice Login (2nd attempt) (#3078) 2023-11-24 22:34:13 +01:00
login_test.go Appservice Login (2nd attempt) (#3078) 2023-11-24 22:34:13 +01:00
logout.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
membership.go Fix /createRoom and /invite containing displayname/avatarURL of inviter (#3326) 2024-02-13 19:28:52 +01:00
memberships.go Move /joined_members back to the clientapi/roomserver (#3312) 2024-01-25 21:35:05 +01:00
notification.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
openid.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
password.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
peekroom.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
presence.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
profile.go Fix state resets (#3231) 2023-10-23 15:17:21 +02:00
pusher.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
pushrules.go Fix: Edited messages appear twice in fulltext search (#3363) 2024-07-27 22:30:17 +02:00
receipt.go Appservice Login (2nd attempt) (#3078) 2023-11-24 22:34:13 +01:00
redaction.go Support for room version v11 (#3204) 2023-09-27 08:27:08 +02:00
register.go Don't send device list updates upon registration (#3307) 2024-01-20 21:20:37 +01:00
register_secret.go Handle DisplayName field in admin user registration endpoint (#2935) 2023-01-10 18:09:25 +00:00
register_secret_test.go Handle DisplayName field in admin user registration endpoint (#2935) 2023-01-10 18:09:25 +00:00
register_test.go Refactor registration tests, remove hard-coded username validation (#3138) 2023-11-22 12:15:16 +00:00
report_event.go Add event reporting (#3340) 2024-03-21 19:27:34 +01:00
room_hierarchy.go Fix spaces over federation (#3347) 2024-03-28 20:40:45 +01:00
room_tagging.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
routing.go Take advantage of changes in recent Go versions (#3361) 2024-05-01 00:38:36 +00:00
sendevent.go #3333 used ts parameter for appservices 2024-08-16 18:43:44 +05:30
sendevent_test.go Fix: Edited messages appear twice in fulltext search (#3363) 2024-07-27 22:30:17 +02:00
sendtodevice.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
sendtyping.go Cleanup remaining statekey usage for senderIDs (#3106) 2023-06-12 11:19:25 +00:00
server_notices.go Fix /createRoom and /invite containing displayname/avatarURL of inviter (#3326) 2024-02-13 19:28:52 +01:00
server_notices_test.go Implement server notices (#2180) 2022-02-18 16:05:03 +01:00
state.go Move pseudoID ClientEvent hotswapping to a common location (#3199) 2023-09-15 15:25:09 +00:00
state_test.go [pseudoIDs] More pseudo ID fixes - Part 2 (#3181) 2023-08-24 16:43:51 +01:00
thirdparty.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
threepid.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
upgrade_room.go Cleanup remaining statekey usage for senderIDs (#3106) 2023-06-12 11:19:25 +00:00
userdirectory.go Move fedclient interface over to gmsl (#3061) 2023-04-24 16:23:25 +00:00
voip.go Move MakeJoin logic to GMSL (#3081) 2023-05-17 00:33:27 +00:00
whoami.go Update /whoami response to match Spec v1.2 (#2201) 2022-02-18 11:28:02 +00:00