mirror of https://gitlab.com/litecord/litecord.git
channel.messages: insert guild_id information
so that we're able to search all messages in a guild without doing JOINs.
This commit is contained in:
parent
93e00315df
commit
48a65325f4
|
|
@ -143,8 +143,11 @@ async def create_message(channel_id):
|
||||||
user_id = await token_check()
|
user_id = await token_check()
|
||||||
ctype, guild_id = await channel_check(user_id, channel_id)
|
ctype, guild_id = await channel_check(user_id, channel_id)
|
||||||
|
|
||||||
|
actual_guild_id = None
|
||||||
|
|
||||||
if ctype in GUILD_CHANS:
|
if ctype in GUILD_CHANS:
|
||||||
await channel_perm_check(user_id, channel_id, 'send_messages')
|
await channel_perm_check(user_id, channel_id, 'send_messages')
|
||||||
|
actual_guild_id = guild_id
|
||||||
|
|
||||||
j = validate(await request.get_json(), MESSAGE_CREATE)
|
j = validate(await request.get_json(), MESSAGE_CREATE)
|
||||||
message_id = get_snowflake()
|
message_id = get_snowflake()
|
||||||
|
|
@ -165,12 +168,13 @@ async def create_message(channel_id):
|
||||||
|
|
||||||
await app.db.execute(
|
await app.db.execute(
|
||||||
"""
|
"""
|
||||||
INSERT INTO messages (id, channel_id, author_id, content, tts,
|
INSERT INTO messages (id, channel_id, guild_id, author_id,
|
||||||
mention_everyone, nonce, message_type)
|
content, tts, mention_everyone, nonce, message_type)
|
||||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
||||||
""",
|
""",
|
||||||
message_id,
|
message_id,
|
||||||
channel_id,
|
channel_id,
|
||||||
|
actual_guild_id,
|
||||||
user_id,
|
user_id,
|
||||||
j['content'],
|
j['content'],
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue