diff --git a/src/api/routes/users/@me/settings-proto/1.ts b/src/api/routes/users/@me/settings-proto/1.ts
index 71ff46b9..dcbad884 100644
--- a/src/api/routes/users/@me/settings-proto/1.ts
+++ b/src/api/routes/users/@me/settings-proto/1.ts
@@ -19,6 +19,7 @@
import { route } from "@spacebar/api";
import { Request, Response, Router } from "express";
import {
+ emitEvent,
OrmUtils,
SettingsProtoJsonResponse,
SettingsProtoResponse,
@@ -192,6 +193,23 @@ async function patchUserSettings(
userSettings.userSettings = settings;
await userSettings.save();
+ await emitEvent({
+ event: "USER_SETTINGS_PROTO_UPDATE",
+ data: {
+ settings: {
+ proto: PreloadedUserSettings.toBase64(settings),
+ type: 1
+ },
+ json_settings: {
+ proto: PreloadedUserSettings.toJson(settings),
+ type: "user_settings"
+ },
+ partial: false, // Unsure how this should behave
+ }
+ });
+ // This should also send a USER_SETTINGS_UPDATE event, but that isn't sent
+ // when using the USER_SETTINGS_PROTOS capability, so we ignore it for now.
+
return {
settings: settings,
out_of_date: false,
diff --git a/src/api/routes/users/@me/settings-proto/2.ts b/src/api/routes/users/@me/settings-proto/2.ts
index dbb331f5..1ca34de7 100644
--- a/src/api/routes/users/@me/settings-proto/2.ts
+++ b/src/api/routes/users/@me/settings-proto/2.ts
@@ -19,6 +19,7 @@
import { route } from "@spacebar/api";
import { Request, Response, Router } from "express";
import {
+ emitEvent,
OrmUtils,
SettingsProtoJsonResponse,
SettingsProtoResponse,
@@ -194,6 +195,23 @@ async function patchUserSettings(
userSettings.frecencySettings = settings;
await userSettings.save();
+ await emitEvent({
+ event: "USER_SETTINGS_PROTO_UPDATE",
+ data: {
+ settings: {
+ proto: FrecencyUserSettings.toBase64(settings),
+ type: 2
+ },
+ json_settings: {
+ proto: FrecencyUserSettings.toJson(settings),
+ type: "frecency_settings"
+ },
+ partial: false, // Unsure how this should behave
+ }
+ });
+ // This should also send a USER_SETTINGS_UPDATE event, but that isn't sent
+ // when using the USER_SETTINGS_PROTOS capability, so we ignore it for now.
+
return {
settings: settings,
out_of_date: false,
|