0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

modules/client/presence: Make redundant status return normally.

This commit is contained in:
Jason Volk 2018-04-23 18:22:26 -07:00
parent 1e0d17935b
commit 6aebe1f01e

View file

@ -319,13 +319,8 @@ put__presence_status(client &client,
request.user_id
};
// note: Riot hits this endpoint with redundant updates every single time
// the user waves their mouse over the browser window. Right now we throw
// NOT_MODIFIED and do nothing because each presence update writes a msg
// to the user's room. In the future we can put a conf/hook here to do
// more w/ this data though.
m::presence::get(std::nothrow, user, [&presence, &status_msg]
bool modified{true};
m::presence::get(std::nothrow, user, [&modified, &presence, &status_msg]
(const json::object &object)
{
if(unquote(object.get("presence")) != presence)
@ -334,13 +329,15 @@ put__presence_status(client &client,
if(unquote(object.get("status_msg")) != status_msg)
return;
throw m::error
{
http::NOT_MODIFIED, "M_NOT_MODIFIED",
"Presence state or status has not changed"
};
modified = false;
});
if(!modified)
return resource::response
{
client, http::OK
};
const auto eid
{
m::presence::set(user, presence, status_msg)