Commit Graph

4045 Commits

Author SHA1 Message Date
Zane Helton ff692c19b7 Await guild creation to fix a race condition
`Promise.all(...)` runs these simultaneously, yet role depends on the
guild to be created first. This can lead to a race condition. I've
awaited role creation too because the call to `Member.addToGuild(...)`
relies on the role to be created.
2025-06-29 13:27:14 +10:00
Zane Helton 4772731a17 Fix PATCH Template route implementation
The previous PATCH implementation was creating a new template rather
than editing the existing template. This resulted in all requests
failing because it was missing more than one required field.

Resolves: #1281
2025-06-29 13:25:22 +10:00
Zane Helton 0166bbf12a Make ban reason nullable
Resolves: #1276
2025-06-29 13:24:26 +10:00
Zane Helton 4f75919651 Add OP to message.mentions when replied to
The `message.message_reference` stores:

1. `message_id`
2. `channel_id`
3. `guild_id`

We use the `message_id` and `channel_id` to `.findOne(...)` Message, and
find the author. If the author is the same as OP, we skip (so replying
to yourself doesn't add you to the mentions array) otherwise, it adds
the author_id to the mentions array.

Resolves: #1247
2025-06-29 09:14:58 +10:00
Zane Helton e8d3f655a3 Preserve reactions when a message is edited
Resolves #1241
2025-06-29 08:44:47 +10:00
Zane Helton 81d4313631 Properly filter existing embed links
In a previous PR, I was checking if the `.url` property existed, the
correct fix is to remove any embed that isn't a rich embed
type (non-link).

See also: #1296
2025-06-29 08:39:42 +10:00
Zane Helton f81e5f6afa Change how GUILD_DELETE cleans up the listener
Adding `this.events[id]?.()` cleans up the listener. I removed
`opts.cancel()` because with it, the event had issues firing after the
first time.

Resolves: #1242
2025-06-29 08:39:25 +10:00
Zane Helton 184433b078 Start fresh when updating embeds for links
In a previous commit I was attempting to be clever by only
replacing/removing embeds if necessary. This not only made the logic
more confusing but introduced a bug that would allow for orphaned
embeds when updating the search params of a URL.

This commit will remove all embeds that have a `.url` property and start
fresh. This simplifies the code and eliminates the aforementioned bug.
2025-06-28 18:30:52 +10:00
Zane Helton f9cfb46e73 Fix various issues with embeds on message updates
The `postHandleMessage` function is parsing links and adding them to the
EmbedCache table if necessary. In the previous implementation, message
updates would push to the embeds unconditionally.

This commit parses links from the message and:

1. Normalizes the URLs
  - Useful for deduplicating similar URLs
2. Remove embeds with matching normalized URLs
  - Leaves all embeds except for ones with a `.url` property matching
  the updated message
  - This allows embeds to be re-ordered if the URL is moved
3. If no normalized URLs are found, remove all embeds
4. Take the deduplicated + normalized URLs and add an embed to the message and
insert into the EmbedCache table (if necessary)

This enables:

1. Embeds to be re-ordered by re-ordering links
2. Embeds to be removed by removing links

and fixes:

1. Duplicate embeds being attached to a message when edited
2025-06-28 18:30:52 +10:00
Zane Helton c0f9c22e67 Add validation to date_of_birth registration field
Resolves: #1020
2025-06-28 17:08:00 +10:00
Puyodead1 ac1779b480 update webrtc types package 2025-06-25 23:17:14 -04:00
dank074 526a8da8f5 add webrtc support (#1284)
Co-authored-by: MaddyUnderStars <46743919+MaddyUnderStars@users.noreply.github.com>
2025-06-22 12:41:13 +10:00
MathMan05 f03c6209a4 send the real index 2025-05-28 08:46:35 +02:00
MathMan05 e219c1a33a code relies on things done in a certain order
This makes sure that the code gets done in the order that is expected
2025-05-28 08:46:35 +02:00
MathMan05 4f6211ce50 remove missed log 2025-05-28 08:46:35 +02:00
MathMan05 04ddfadbb6 sort array to make algorithm happy 2025-05-28 08:46:35 +02:00
MathMan05 91361ea9c6 fix another stupid bug 2025-05-28 08:46:35 +02:00
MathMan05 1550ccd099 don't set possition if sent 2025-05-28 08:46:35 +02:00
MathMan05 246b493d76 remove logs 2025-05-28 08:46:35 +02:00
MathMan05 5488874476 delete the null eater 2025-05-28 08:46:35 +02:00
MathMan05 af70a7f21b channel is nullable fixes 2025-05-28 08:46:35 +02:00
MathMan05 a4c50ae922 forgot to test on rebuild 2025-05-28 08:46:35 +02:00
MathMan05 a9bff7554a fix moving channels 2025-05-28 08:46:35 +02:00
Emma [it/its]@Rory& 24292592c4 Fix nix hashes
Signed-off-by: Emma [it/its]@Rory& <root@rory.gay>
2025-05-03 13:15:13 +02:00
Puyodead1 6e85be3a05 Update attachments.ts 2025-05-03 12:30:22 +02:00
Puyodead1 080b2c7d38 Implement signed cdn urls 2025-05-03 12:30:22 +02:00
Madeline 1d8e081fd8 Merge pull request #1274 from dank074/patch/fix-requestGuildMembers-libraires
fix op 8 handler for some discord libraries
2025-04-13 08:03:31 +10:00
dank074 3bf3adfa82 fix op 8 handler for some discord libraries 2025-04-12 16:25:40 -05:00
Madeline 3ccf33950f Merge pull request #1269 from dank074/patch/fix-missing-guildcreate-properties 2025-04-12 22:12:53 +10:00
Madeline 4169602ecb Merge pull request #1273 from dank074/patch/fix-members-list
add op handler for `GUILD_SUBSCRIPTIONS_BULK` message
2025-04-12 20:15:12 +10:00
dank074 0ed7a8af77 add ophandler for GuildSubscriptionsBulk message 2025-04-12 05:01:37 -05:00
dank074 fd33d58af8 revert back to original schema, but add missing members 2025-04-11 18:39:45 -05:00
Madeline 39b19d536c Merge pull request #1270 from dank074/patch/fix-pins 2025-04-10 09:47:17 +10:00
dank074 bb84bc83e5 add author to query in pins API 2025-04-09 18:42:56 -05:00
dank074 f41164945e add type to make sure payload is consistent with other GUILD_CREATE event 2025-04-09 16:16:40 -05:00
dank074 64d5dcd53f fix missing properties in GUILD_CREATE for bots 2025-04-09 15:39:17 -05:00
Emma [it/its]@Rory& 126a881f31 Prettier 2025-04-09 16:38:03 +02:00
Emma [it/its]@Rory& 2a7051bdc8 Update nix 2025-04-09 16:38:03 +02:00
Emma [it/its]@Rory& ebc063df97 Fix dependencies 2025-04-09 16:38:03 +02:00
Puyodead1 016c0ff760 Merge pull request #1266 from MathMan05/patch-7
fix password reset bug
2025-04-03 16:57:48 -04:00
MathMan05 d267b08ab5 stupid fix 2025-04-03 12:53:03 -05:00
MathMan05 99cc009670 fix password reset bug
Not sure if this'll work, but made a pull so y'all could see the issue
2025-04-03 12:52:11 -05:00
Puyodead1 89abd2ec12 Merge pull request #1265 from thedudedies21/Update_Base_Webhooks
Finish Webhooks, and add config endpoint for client
2025-03-30 23:26:31 -04:00
root d8b1a8484c Validate Name for webhooks enforced more 2025-03-25 16:02:47 -07:00
root 52efef274b Modified Flake.lock to not fail the check 2025-03-25 11:41:47 -07:00
root cabc49a1ba Added can_recover_account value to /api/policies/instance/config 2025-03-25 11:26:36 -07:00
root 541af2045d Added better user configuration and removed extra logging 2025-03-25 11:15:14 -07:00
Munchy 7320aa4529 Merge branch 'spacebarchat:master' into master 2025-03-24 10:35:27 -04:00
Munchy d70a00267d Merge pull request #2 from thedudedies21/Update_Base_Webhooks
Update base webhooks
2025-03-24 10:35:00 -04:00
root d0948c0e49 Updated error message for empty webhook update body 2025-03-24 07:29:56 -07:00