summaryrefslogtreecommitdiff
path: root/src/stream.cpp
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-05-16 21:58:52 +0500
committerilotterytea <iltsu@alright.party>2024-05-16 21:58:52 +0500
commit4ebfa4f82679b5edafca70b2da1646d5d1b2decc (patch)
treea7fb2a89954cb23a712816d491b2a3163668ffcd /src/stream.cpp
parent49e41eaff5c219e4e8452188f19974bf019c33e4 (diff)
upd: send nothing if the channel is opted out
Diffstat (limited to 'src/stream.cpp')
-rw-r--r--src/stream.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/stream.cpp b/src/stream.cpp
index 4868995..ad7df68 100644
--- a/src/stream.cpp
+++ b/src/stream.cpp
@@ -87,9 +87,14 @@ namespace bot::stream {
" AND target_alias_id = " + std::to_string(stream.user_id));
for (const auto &event : events) {
- pqxx::row channel =
- work.exec1("SELECT alias_id, alias_name FROM channels WHERE id = " +
- std::to_string(event[1].as<int>()));
+ pqxx::row channel = work.exec1(
+ "SELECT alias_id, alias_name, opted_out_at FROM channels WHERE id "
+ "= " +
+ std::to_string(event[1].as<int>()));
+
+ if (!channel[2].is_null()) {
+ continue;
+ }
pqxx::result subs = work.exec(
"SELECT user_id FROM event_subscriptions WHERE event_id = " +