# events[].sql_query.sql
SELECT "screened_ip_addresses".* FROM "screened_ip_addresses" WHERE ('99.232.23.194' <<= ip_address) LIMIT 1

# events[].sql_query.normalized_sql
SELECT "screened_ip_addresses".* FROM "screened_ip_addresses" WHERE ($1 <<= ip_address) LIMIT $2

# events[].sql_query.sql
SELECT "screened_emails".* FROM "screened_emails" ORDER BY "screened_emails"."created_at" DESC LIMIT 100

# events[].sql_query.normalized_sql
SELECT "screened_emails".* FROM "screened_emails" ORDER BY "screened_emails"."created_at" DESC LIMIT $1

# events[].sql_query.sql
SELECT 1 AS one FROM "user_emails" WHERE (lower(email) = 'bruce628@wayne.com') LIMIT 1

# events[].sql_query.normalized_sql
SELECT $1 AS one FROM "user_emails" WHERE (lower(email) = $2) LIMIT $3

# events[].sql_query.normalized_sql
INSERT INTO "users" ("username", "created_at", "updated_at", "name", "password_hash", "salt", "active", "username_lower", "trust_level", "ip_address") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING "id"

# events[].sql_query.sql
SELECT "screened_emails".* FROM "screened_emails" ORDER BY "screened_emails"."created_at" DESC LIMIT 100

# events[].sql_query.normalized_sql
SELECT "screened_emails".* FROM "screened_emails" ORDER BY "screened_emails"."created_at" DESC LIMIT $1

# events[].sql_query.sql
SELECT 1 AS one FROM "user_emails" WHERE "user_emails"."primary" = TRUE AND "user_emails"."user_id" = 703 LIMIT 1

# events[].sql_query.normalized_sql
SELECT $1 AS one FROM "user_emails" WHERE "user_emails"."primary" = $2 AND "user_emails"."user_id" = $3 LIMIT $4

# events[].sql_query.sql
SELECT 1 AS one FROM "user_emails" WHERE (lower(email) = 'bruce628@wayne.com') LIMIT 1

# events[].sql_query.normalized_sql
SELECT $1 AS one FROM "user_emails" WHERE (lower(email) = $2) LIMIT $3

# events[].sql_query.normalized_sql
INSERT INTO "user_emails" ("user_id", "email", "primary", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"

# events[].sql_query.normalized_sql
INSERT INTO "email_tokens" ("user_id", "email", "token", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"

# events[].sql_query.sql
UPDATE "email_tokens" SET "expired" = TRUE WHERE "email_tokens"."user_id" = 703 AND (id != 704)

# events[].sql_query.normalized_sql
UPDATE "email_tokens" SET "expired" = $1 WHERE "email_tokens"."user_id" = $2 AND (id != $3)

# events[].sql_query.normalized_sql
INSERT INTO "user_stats" ("user_id", "new_since") VALUES ($1, $2) RETURNING "user_id"

# events[].sql_query.sql
SELECT "users".* FROM "users" WHERE "users"."id" = 703 LIMIT 1

# events[].sql_query.normalized_sql
SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2

# events[].sql_query.sql
UPDATE "topic_users" SET notification_level = CASE WHEN total_msecs_viewed < 240000 THEN 1 ELSE 2 END WHERE "topic_users"."notifications_reason_id" IS NULL AND "topic_users"."user_id" = 703

# events[].sql_query.normalized_sql
UPDATE "topic_users" SET notification_level = CASE WHEN total_msecs_viewed < $1 THEN $2 ELSE $3 END WHERE "topic_users"."notifications_reason_id" IS NULL AND "topic_users"."user_id" = $4

# events[].sql_query.sql
SELECT "users".* FROM "users" WHERE "users"."id" = 703 LIMIT 1

# events[].sql_query.normalized_sql
SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2

# events[].sql_query.sql
INSERT INTO "user_profiles" ("user_id") VALUES (703) RETURNING "user_id"

# events[].sql_query.normalized_sql
INSERT INTO "user_profiles" ("user_id") VALUES ($1) RETURNING "user_id"

# events[].parameters[].value
{:user=>#<UserProfile user_id: 703, location: nil, website: nil, bio_raw: nil, bio_cooked: nil, dism

# events[].sql_query.sql
SELECT "tags"."id" FROM "tags" WHERE 1=0

# events[].sql_query.normalized_sql
SELECT "tags"."id" FROM "tags" WHERE $1=$2

# events[].sql_query.sql
SELECT "tags"."id" FROM "tags" WHERE 1=0

# events[].sql_query.normalized_sql
SELECT "tags"."id" FROM "tags" WHERE $1=$2

# events[].sql_query.sql
SELECT "tags"."id" FROM "tags" WHERE 1=0

# events[].sql_query.normalized_sql
SELECT "tags"."id" FROM "tags" WHERE $1=$2

# events[].sql_query.sql
SELECT "tags"."id" FROM "tags" WHERE 1=0

# events[].sql_query.normalized_sql
SELECT "tags"."id" FROM "tags" WHERE $1=$2

# events[].sql_query.sql
SELECT "user_avatars".* FROM "user_avatars" WHERE "user_avatars"."user_id" = 703 LIMIT 1

# events[].sql_query.normalized_sql
SELECT "user_avatars".* FROM "user_avatars" WHERE "user_avatars"."user_id" = $1 LIMIT $2

# events[].sql_query.normalized_sql
INSERT INTO "user_avatars" ("user_id", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"

# events[].sql_query.sql
SELECT 1 AS one FROM "web_hooks" INNER JOIN "web_hook_event_types_hooks" ON "web_hook_event_types_hooks"."web_hook_id" = "web_hooks"."id" INNER JOIN "web_hook_event_types" ON "web_hook_event_types"."id" = "web_hook_event_types_hooks"."web_hook_event_type_id" WHERE "web_hooks"."active" = TRUE AND (web_hooks.wildcard_web_hook = TRUE OR web_hook_event_types.name = 'user') LIMIT 1

# events[].sql_query.normalized_sql
SELECT $1 AS one FROM "web_hooks" INNER JOIN "web_hook_event_types_hooks" ON "web_hook_event_types_hooks"."web_hook_id" = "web_hooks"."id" INNER JOIN "web_hook_event_types" ON "web_hook_event_types"."id" = "web_hook_event_types_hooks"."web_hook_event_type_id" WHERE "web_hooks"."active" = $2 AND (web_hooks.wildcard_web_hook = $3 OR web_hook_event_types.name = $4) LIMIT $5

# events[].sql_query.sql
SELECT "users".* FROM "users" WHERE "users"."username_lower" = 'bruce628' LIMIT 1

# events[].sql_query.normalized_sql
SELECT "users".* FROM "users" WHERE "users"."username_lower" = $1 LIMIT $2

# events[].sql_query.normalized_sql
INSERT INTO "user_auth_tokens" ("user_id", "auth_token", "prev_auth_token", "client_ip", "rotated_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"

# events[].sql_query.normalized_sql
INSERT INTO "user_auth_token_logs" ("action", "user_auth_token_id", "user_id", "client_ip", "auth_token", "created_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id"

# events[].sql_query.sql
DELETE FROM "user_auth_tokens" WHERE "user_auth_tokens"."id" IN (SELECT "user_auth_tokens"."id" FROM "user_auth_tokens" WHERE "user_auth_tokens"."user_id" = 703 AND (rotated_at > '2020-07-20 16:24:28.925448') ORDER BY rotated_at DESC OFFSET 60)

# events[].sql_query.normalized_sql
DELETE FROM "user_auth_tokens" WHERE "user_auth_tokens"."id" IN (SELECT "user_auth_tokens"."id" FROM "user_auth_tokens" WHERE "user_auth_tokens"."user_id" = $1 AND (rotated_at > $2) ORDER BY rotated_at DESC OFFSET $3)

# events[].sql_query.sql
SELECT 1 AS one FROM "web_hooks" INNER JOIN "web_hook_event_types_hooks" ON "web_hook_event_types_hooks"."web_hook_id" = "web_hooks"."id" INNER JOIN "web_hook_event_types" ON "web_hook_event_types"."id" = "web_hook_event_types_hooks"."web_hook_event_type_id" WHERE "web_hooks"."active" = TRUE AND (web_hooks.wildcard_web_hook = TRUE OR web_hook_event_types.name = 'user') LIMIT 1

# events[].sql_query.normalized_sql
SELECT $1 AS one FROM "web_hooks" INNER JOIN "web_hook_event_types_hooks" ON "web_hook_event_types_hooks"."web_hook_id" = "web_hooks"."id" INNER JOIN "web_hook_event_types" ON "web_hook_event_types"."id" = "web_hook_event_types_hooks"."web_hook_event_type_id" WHERE "web_hooks"."active" = $2 AND (web_hooks.wildcard_web_hook = $3 OR web_hook_event_types.name = $4) LIMIT $5

# events[].return_value.value
You are being redirected.

# events[].sql_query.sql
SELECT "users".* FROM "users" WHERE "users"."id" = 703 LIMIT 1

# events[].sql_query.normalized_sql
SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2

# events[].sql_query.sql
SELECT "user_auth_tokens".* FROM "user_auth_tokens" WHERE ((auth_token = 'VNq1HNGSr0aIgN7X5OdCQQxKH3Q=' OR
                          prev_auth_token = 'VNq1HNGSr0aIgN7X5OdCQQxKH3Q=') AND rotated_at > '2020-07-20 16:24:28.950458') LIMIT 1

# events[].sql_query.normalized_sql
SELECT "user_auth_tokens".* FROM "user_auth_tokens" WHERE ((auth_token = $1 OR
                          prev_auth_token = $2) AND rotated_at > $3) LIMIT $4

# events[].sql_query.sql
UPDATE "user_auth_tokens" SET "auth_token_seen" = TRUE, "seen_at" = '2020-09-18 16:24:28.956870' WHERE "user_auth_tokens"."id" = 286 AND "user_auth_tokens"."auth_token" = 'VNq1HNGSr0aIgN7X5OdCQQxKH3Q='

# events[].sql_query.normalized_sql
UPDATE "user_auth_tokens" SET "auth_token_seen" = $1, "seen_at" = $2 WHERE "user_auth_tokens"."id" = $3 AND "user_auth_tokens"."auth_token" = $4

# events[].sql_query.normalized_sql
INSERT INTO "user_auth_token_logs" ("action", "user_auth_token_id", "user_id", "client_ip", "auth_token", "created_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id"

# events[].sql_query.sql
SELECT "users".* FROM "users" WHERE "users"."id" = 703 LIMIT 1

# events[].sql_query.normalized_sql
SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2

# events[].sql_query.sql
SELECT "user_visits".* FROM "user_visits" WHERE "user_visits"."user_id" = 703 AND "user_visits"."visited_at" = '2020-09-18' LIMIT 1

# events[].sql_query.normalized_sql
SELECT "user_visits".* FROM "user_visits" WHERE "user_visits"."user_id" = $1 AND "user_visits"."visited_at" = $2 LIMIT $3

# events[].sql_query.sql
UPDATE "user_stats" SET "days_visited" = 1 WHERE "user_stats"."user_id" = 703

# events[].sql_query.normalized_sql
UPDATE "user_stats" SET "days_visited" = $1 WHERE "user_stats"."user_id" = $2

# events[].sql_query.sql
INSERT INTO "user_visits" ("user_id", "visited_at") VALUES (703, '2020-09-18') RETURNING "id"

# events[].sql_query.normalized_sql
INSERT INTO "user_visits" ("user_id", "visited_at") VALUES ($1, $2) RETURNING "id"

# events[].sql_query.normalized_sql
UPDATE "users" SET "last_seen_at" = $1 WHERE "users"."id" = $2

# events[].sql_query.normalized_sql
UPDATE "users" SET "first_seen_at" = $1 WHERE "users"."id" = $2

# events[].sql_query.normalized_sql
UPDATE "users" SET "ip_address" = $1 WHERE "users"."id" = $2

# events[].sql_query.sql
SELECT "user_options".* FROM "user_options" WHERE "user_options"."user_id" = 703 LIMIT 1

# events[].sql_query.normalized_sql
SELECT "user_options".* FROM "user_options" WHERE "user_options"."user_id" = $1 LIMIT $2

# events[].sql_query.sql
SELECT "groups"."id", "groups"."name" FROM "groups" WHERE ( groups.id IN (
   SELECT id
     FROM groups
    WHERE visibility_level = 0

   UNION ALL

   SELECT id
     FROM groups
    WHERE visibility_level = 1
      AND 703 IS NOT NULL

   UNION ALL

   SELECT g.id
     FROM groups g
     JOIN group_users gu ON gu.group_id = g.id AND gu.user_id = 703
    WHERE g.visibility_level = 2

   UNION ALL

   SELECT g.id
     FROM groups g
LEFT JOIN group_users gu ON gu.group_id = g.id AND gu.user_id = 703 AND gu.owner
    WHERE g.visibility_level = 3
      AND (gu.id IS NOT NULL OR FALSE)

   UNION ALL

   SELECT g.id
     FROM groups g
     JOIN group_users gu ON gu.group_id = g.id AND gu.user_id = 703 AND gu.owner
    WHERE g.visibility_level = 4
 )
) ORDER BY name ASC, "groups"."name" ASC

# events[].sql_query.normalized_sql
SELECT "groups"."id", "groups"."name" FROM "groups" WHERE ( groups.id IN (
   SELECT id
     FROM groups
    WHERE visibility_level = $1

   UNION ALL

   SELECT id
     FROM groups
    WHERE visibility_level = $2
      AND $3 IS NOT NULL

   UNION ALL

   SELECT g.id
     FROM groups g
     JOIN group_users gu ON gu.group_id = g.id AND gu.user_id = $4
    WHERE g.visibility_level = $5

   UNION ALL

   SELECT g.id
     FROM groups g
LEFT JOIN group_users gu ON gu.group_id = g.id AND gu.user_id = $6 AND gu.owner
    WHERE g.visibility_level = $7
      AND (gu.id IS NOT NULL OR $8)

   UNION ALL

   SELECT g.id
     FROM groups g
     JOIN group_users gu ON gu.group_id = g.id AND gu.user_id = $9 AND gu.owner
    WHERE g.visibility_level = $10
 )
) ORDER BY name ASC, "groups"."name" ASC

# events[].sql_query.sql
SELECT COUNT(*) FROM (SELECT 1 AS one FROM "topics" WHERE ("topics"."deleted_at" IS NULL) LIMIT 16) subquery_for_count

# events[].sql_query.normalized_sql
SELECT COUNT(*) FROM (SELECT $1 AS one FROM "topics" WHERE ("topics"."deleted_at" IS NULL) LIMIT $2) subquery_for_count

# events[].sql_query.sql
SELECT "users"."id" FROM "users" INNER JOIN "user_auth_tokens" ON "user_auth_tokens"."user_id" = "users"."id" WHERE "users"."admin" = TRUE AND (users.id > 0) ORDER BY user_auth_tokens.created_at LIMIT 1

# events[].sql_query.normalized_sql
SELECT "users"."id" FROM "users" INNER JOIN "user_auth_tokens" ON "user_auth_tokens"."user_id" = "users"."id" WHERE "users"."admin" = $1 AND (users.id > $2) ORDER BY user_auth_tokens.created_at LIMIT $3

# events[].sql_query.sql
SELECT categories.id FROM "categories" INNER JOIN "category_groups" ON "categories"."id" = "category_groups"."category_id" INNER JOIN "groups" ON "category_groups"."group_id" = "groups"."id" INNER JOIN "group_users" ON "groups"."id" = "group_users"."group_id" WHERE "group_users"."user_id" = 703

# events[].sql_query.normalized_sql
SELECT categories.id FROM "categories" INNER JOIN "category_groups" ON "categories"."id" = "category_groups"."category_id" INNER JOIN "groups" ON "category_groups"."group_id" = "groups"."id" INNER JOIN "group_users" ON "groups"."id" = "group_users"."group_id" WHERE "group_users"."user_id" = $1

# events[].sql_query.sql
SELECT categories.*, t.slug topic_slug FROM "categories" LEFT JOIN topics t on t.id = categories.topic_id WHERE (NOT categories.read_restricted) ORDER BY "categories"."position" ASC

# events[].sql_query.normalized_sql
SELECT categories.*, t.slug topic_slug FROM "categories" LEFT JOIN topics t on t.id = categories.topic_id WHERE (NOT categories.read_restricted) ORDER BY "categories"."position" ASC

# events[].sql_query.sql
SELECT "categories"."id" FROM "categories" WHERE ((FALSE AND LENGTH(COALESCE(email_in, '')) > 0 AND email_in_allow_strangers)
          OR categories.id NOT IN (SELECT category_id FROM category_groups)
          OR categories.id IN (
                SELECT category_id
                  FROM category_groups
                 WHERE permission_type IN (1)
                   AND (group_id = 0 OR group_id IN (SELECT group_id FROM group_users WHERE user_id = 703))
             ))

# events[].sql_query.normalized_sql
SELECT "categories"."id" FROM "categories" WHERE (($1 AND LENGTH(COALESCE(email_in, $2)) > $3 AND email_in_allow_strangers)
          OR categories.id NOT IN (SELECT category_id FROM category_groups)
          OR categories.id IN (
                SELECT category_id
                  FROM category_groups
                 WHERE permission_type IN ($4)
                   AND (group_id = $5 OR group_id IN (SELECT group_id FROM group_users WHERE user_id = $6))
             ))

# events[].return_value.value
[#<Category id: 1, name: "Uncategorized", color: "0088CC", topic_id: nil, topic_count: 0, created_at

# events[].return_value.value
Topics that don't need a category, or don't fit into any other existing category.

# events[].return_value.value
Topics that don't need a category, or don't fit into any other existing category.

# events[].return_value.value
Topics that don't need a category, or don't fit into any other existing category.

# events[].sql_query.sql
SELECT "user_fields".* FROM "user_fields" ORDER BY "user_fields"."position" ASC

# events[].sql_query.normalized_sql
SELECT "user_fields".* FROM "user_fields" ORDER BY "user_fields"."position" ASC

# events[].sql_query.sql
SELECT 1 AS one FROM "posts" WHERE ("posts"."deleted_at" IS NULL) AND "posts"."user_id" = 703 LIMIT 1

# events[].sql_query.normalized_sql
SELECT $1 AS one FROM "posts" WHERE ("posts"."deleted_at" IS NULL) AND "posts"."user_id" = $2 LIMIT $3

# events[].sql_query.sql
SELECT "tag_users"."tag_id" FROM "tag_users" WHERE "tag_users"."user_id" = 703 AND "tag_users"."notification_level" = 0

# events[].sql_query.normalized_sql
SELECT "tag_users"."tag_id" FROM "tag_users" WHERE "tag_users"."user_id" = $1 AND "tag_users"."notification_level" = $2

# events[].sql_query.sql
SELECT "user_profiles".* FROM "user_profiles" WHERE "user_profiles"."user_id" = 703 LIMIT 1

# events[].sql_query.normalized_sql
SELECT "user_profiles".* FROM "user_profiles" WHERE "user_profiles"."user_id" = $1 LIMIT $2

# events[].sql_query.normalized_sql
SELECT "plugin_store_rows".* FROM "plugin_store_rows" WHERE "plugin_store_rows"."plugin_name" = $1 AND "plugin_store_rows"."key" = $2 LIMIT $3

# events[].sql_query.normalized_sql
SELECT "categories"."id" FROM "categories" WHERE "categories"."read_restricted" = $1

# events[].sql_query.sql
SELECT categories.id FROM "categories" INNER JOIN "category_groups" ON "categories"."id" = "category_groups"."category_id" INNER JOIN "groups" ON "category_groups"."group_id" = "groups"."id" INNER JOIN "group_users" ON "groups"."id" = "group_users"."group_id" WHERE "group_users"."user_id" = 703

# events[].sql_query.normalized_sql
SELECT categories.id FROM "categories" INNER JOIN "category_groups" ON "categories"."id" = "category_groups"."category_id" INNER JOIN "groups" ON "category_groups"."group_id" = "groups"."id" INNER JOIN "group_users" ON "groups"."id" = "group_users"."group_id" WHERE "group_users"."user_id" = $1

# events[].sql_query.sql
SELECT COUNT(*) FROM "reviewables" WHERE ((reviewables.reviewable_by_moderator AND FALSE) OR (reviewables.reviewable_by_group_id IN (NULL))) AND (reviewables.category_id IS NULL OR reviewables.category_id IN (1)) AND "reviewables"."status" = 0

# events[].sql_query.normalized_sql
SELECT COUNT(*) FROM "reviewables" WHERE ((reviewables.reviewable_by_moderator AND $1) OR (reviewables.reviewable_by_group_id IN ($2))) AND (reviewables.category_id IS NULL OR reviewables.category_id IN ($3)) AND "reviewables"."status" = $4

# events[].sql_query.sql
SELECT COUNT(*) FROM (SELECT 1 AS one FROM "categories" WHERE ((FALSE AND LENGTH(COALESCE(email_in, '')) > 0 AND email_in_allow_strangers)
          OR categories.id NOT IN (SELECT category_id FROM category_groups)
          OR categories.id IN (
                SELECT category_id
                  FROM category_groups
                 WHERE permission_type IN (1)
                   AND (group_id = 0 OR group_id IN (SELECT group_id FROM group_users WHERE user_id = 703))
             )) LIMIT 1) subquery_for_count

# events[].sql_query.normalized_sql
SELECT COUNT(*) FROM (SELECT $1 AS one FROM "categories" WHERE (($2 AND LENGTH(COALESCE(email_in, $3)) > $4 AND email_in_allow_strangers)
          OR categories.id NOT IN (SELECT category_id FROM category_groups)
          OR categories.id IN (
                SELECT category_id
                  FROM category_groups
                 WHERE permission_type IN ($5)
                   AND (group_id = $6 OR group_id IN (SELECT group_id FROM group_users WHERE user_id = $7))
             )) LIMIT $8) subquery_for_count

# events[].sql_query.sql
SELECT "category_users"."category_id" FROM "category_users" WHERE "category_users"."user_id" = 703 AND "category_users"."notification_level" NOT IN (0, 1) ORDER BY 
        CASE
          WHEN notification_level = 3 THEN 1
          WHEN notification_level = 2 THEN 2
          WHEN notification_level = 4 THEN 3
        END

# events[].sql_query.normalized_sql
SELECT "category_users"."category_id" FROM "category_users" WHERE "category_users"."user_id" = $1 AND "category_users"."notification_level" NOT IN ($2, $3) ORDER BY 
        CASE
          WHEN notification_level = $4 THEN $5
          WHEN notification_level = $6 THEN $7
          WHEN notification_level = $8 THEN $9
        END

# events[].sql_query.sql
SELECT "groups"."id", "groups"."name" FROM "groups" INNER JOIN "group_users" ON "groups"."id" = "group_users"."group_id" WHERE "group_users"."user_id" = 703 AND (groups.id > 0) AND ( groups.id IN (
   SELECT id
     FROM groups
    WHERE visibility_level = 0

   UNION ALL

   SELECT id
     FROM groups
    WHERE visibility_level = 1
      AND 703 IS NOT NULL

   UNION ALL

   SELECT g.id
     FROM groups g
     JOIN group_users gu ON gu.group_id = g.id AND gu.user_id = 703
    WHERE g.visibility_level = 2

   UNION ALL

   SELECT g.id
     FROM groups g
LEFT JOIN group_users gu ON gu.group_id = g.id AND gu.user_id = 703 AND gu.owner
    WHERE g.visibility_level = 3
      AND (gu.id IS NOT NULL OR FALSE)

   UNION ALL

   SELECT g.id
     FROM groups g
     JOIN group_users gu ON gu.group_id = g.id AND gu.user_id = 703 AND gu.owner
    WHERE g.visibility_level = 4
 )
) ORDER BY name ASC

# events[].sql_query.normalized_sql
SELECT "groups"."id", "groups"."name" FROM "groups" INNER JOIN "group_users" ON "groups"."id" = "group_users"."group_id" WHERE "group_users"."user_id" = $1 AND (groups.id > $2) AND ( groups.id IN (
   SELECT id
     FROM groups
    WHERE visibility_level = $3

   UNION ALL

   SELECT id
     FROM groups
    WHERE visibility_level = $4
      AND $5 IS NOT NULL

   UNION ALL

   SELECT g.id
     FROM groups g
     JOIN group_users gu ON gu.group_id = g.id AND gu.user_id = $6
    WHERE g.visibility_level = $7

   UNION ALL

   SELECT g.id
     FROM groups g
LEFT JOIN group_users gu ON gu.group_id = g.id AND gu.user_id = $8 AND gu.owner
    WHERE g.visibility_level = $9
      AND (gu.id IS NOT NULL OR $10)

   UNION ALL

   SELECT g.id
     FROM groups g
     JOIN group_users gu ON gu.group_id = g.id AND gu.user_id = $11 AND gu.owner
    WHERE g.visibility_level = $12
 )
) ORDER BY name ASC

# events[].sql_query.sql
SELECT 1 AS one FROM "user_second_factors" WHERE "user_second_factors"."user_id" = 703 AND "user_second_factors"."method" = 1 AND "user_second_factors"."enabled" = TRUE LIMIT 1

# events[].sql_query.normalized_sql
SELECT $1 AS one FROM "user_second_factors" WHERE "user_second_factors"."user_id" = $2 AND "user_second_factors"."method" = $3 AND "user_second_factors"."enabled" = $4 LIMIT $5

# events[].sql_query.sql
SELECT 1 AS one FROM "user_security_keys" WHERE "user_security_keys"."user_id" = 703 AND "user_security_keys"."enabled" = TRUE AND "user_security_keys"."factor_type" = 0 AND "user_security_keys"."enabled" = TRUE LIMIT 1

# events[].sql_query.normalized_sql
SELECT $1 AS one FROM "user_security_keys" WHERE "user_security_keys"."user_id" = $2 AND "user_security_keys"."enabled" = $3 AND "user_security_keys"."factor_type" = $4 AND "user_security_keys"."enabled" = $5 LIMIT $6

# events[].sql_query.sql
SELECT "username" FROM "ignored_users" INNER JOIN "users" ON "users"."id" = "ignored_users"."ignored_user_id" WHERE "ignored_users"."user_id" = 703

# events[].sql_query.normalized_sql
SELECT "username" FROM "ignored_users" INNER JOIN "users" ON "users"."id" = "ignored_users"."ignored_user_id" WHERE "ignored_users"."user_id" = $1

# events[].sql_query.sql
SELECT "tag_users"."tag_id" FROM "tag_users" WHERE "tag_users"."user_id" = 703 AND "tag_users"."notification_level" = 0

# events[].sql_query.normalized_sql
SELECT "tag_users"."tag_id" FROM "tag_users" WHERE "tag_users"."user_id" = $1 AND "tag_users"."notification_level" = $2

# events[].return_value.value
GREATEST(CASE
                  WHEN COALESCE(uo.new_topic_duration_minutes, 2880) = -1 THEN u.creat

# events[].return_value.value
SELECT 
           u.id AS user_id,
           topics.id AS topic_id,
           topics.created_at,

# events[].return_value.value
SELECT 
           u.id AS user_id,
           topics.id AS topic_id,
           topics.created_at,

# metadata.name
AboutController .index should display the about page for logged in user when login_required is true