mirror of
https://github.com/matrix-construct/construct
synced 2024-05-16 01:43:49 +02:00
modules/web_hook: Search for reactions by contents rather than endswith.
This commit is contained in:
parent
5f5be52fa9
commit
48e0755a79
|
@ -620,7 +620,7 @@ find_reaction_id(const m::room &room,
|
||||||
}
|
}
|
||||||
|
|
||||||
static ircd::m::event::id::buf
|
static ircd::m::event::id::buf
|
||||||
find_reaction_id_endswith(const m::room &room,
|
find_reaction_id_contains(const m::room &room,
|
||||||
const m::user::id &user_id,
|
const m::user::id &user_id,
|
||||||
const m::event::id &event_id,
|
const m::event::id &event_id,
|
||||||
const string_view &label)
|
const string_view &label)
|
||||||
|
@ -633,7 +633,7 @@ find_reaction_id_endswith(const m::room &room,
|
||||||
relates["key"]
|
relates["key"]
|
||||||
};
|
};
|
||||||
|
|
||||||
return endswith(key, label);
|
return has(key, label);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,14 +656,14 @@ clear_reaction(const m::room &room,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
clear_reaction_endswith(const m::room &room,
|
clear_reaction_contains(const m::room &room,
|
||||||
const m::user::id &user_id,
|
const m::user::id &user_id,
|
||||||
const m::event::id &event_id,
|
const m::event::id &event_id,
|
||||||
const string_view &label)
|
const string_view &label)
|
||||||
{
|
{
|
||||||
const auto reaction_id
|
const auto reaction_id
|
||||||
{
|
{
|
||||||
find_reaction_id_endswith(room, user_id, event_id, label)
|
find_reaction_id_contains(room, user_id, event_id, label)
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!reaction_id)
|
if(!reaction_id)
|
||||||
|
@ -1058,15 +1058,8 @@ github_handle__workflow_run(std::ostream &out,
|
||||||
annote = ircd::strlcat(buf, " "_sv);
|
annote = ircd::strlcat(buf, " "_sv);
|
||||||
annote = ircd::strlcat(buf, name);
|
annote = ircd::strlcat(buf, name);
|
||||||
|
|
||||||
const auto reaction_id
|
if(push_event_id && action != "requested") // skip search on first action
|
||||||
{
|
while(clear_reaction_contains(_webhook_room, _webhook_user, push_event_id, name));
|
||||||
push_event_id && action != "requested"? // skip search on first action
|
|
||||||
find_reaction_id_endswith(_webhook_room, _webhook_user, push_event_id, name):
|
|
||||||
m::event::id::buf{}
|
|
||||||
};
|
|
||||||
|
|
||||||
if(reaction_id)
|
|
||||||
m::redact(_webhook_room, _webhook_user, reaction_id, "status change");
|
|
||||||
|
|
||||||
m::annotate(_webhook_room, _webhook_user, push_event_id, annote);
|
m::annotate(_webhook_room, _webhook_user, push_event_id, annote);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue