Emit USER_SETTINGS_PROTO_UPDATE
This commit is contained in:
parent
b62fc8aca8
commit
5466de1c02
@ -19,6 +19,7 @@
|
|||||||
import { route } from "@spacebar/api";
|
import { route } from "@spacebar/api";
|
||||||
import { Request, Response, Router } from "express";
|
import { Request, Response, Router } from "express";
|
||||||
import {
|
import {
|
||||||
|
emitEvent,
|
||||||
OrmUtils,
|
OrmUtils,
|
||||||
SettingsProtoJsonResponse,
|
SettingsProtoJsonResponse,
|
||||||
SettingsProtoResponse,
|
SettingsProtoResponse,
|
||||||
@ -192,6 +193,23 @@ async function patchUserSettings(
|
|||||||
userSettings.userSettings = settings;
|
userSettings.userSettings = settings;
|
||||||
await userSettings.save();
|
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 {
|
return {
|
||||||
settings: settings,
|
settings: settings,
|
||||||
out_of_date: false,
|
out_of_date: false,
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
import { route } from "@spacebar/api";
|
import { route } from "@spacebar/api";
|
||||||
import { Request, Response, Router } from "express";
|
import { Request, Response, Router } from "express";
|
||||||
import {
|
import {
|
||||||
|
emitEvent,
|
||||||
OrmUtils,
|
OrmUtils,
|
||||||
SettingsProtoJsonResponse,
|
SettingsProtoJsonResponse,
|
||||||
SettingsProtoResponse,
|
SettingsProtoResponse,
|
||||||
@ -194,6 +195,23 @@ async function patchUserSettings(
|
|||||||
userSettings.frecencySettings = settings;
|
userSettings.frecencySettings = settings;
|
||||||
await userSettings.save();
|
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 {
|
return {
|
||||||
settings: settings,
|
settings: settings,
|
||||||
out_of_date: false,
|
out_of_date: false,
|
||||||
|
|||||||
@ -732,6 +732,7 @@ export type EVENT =
|
|||||||
| "RELATIONSHIP_ADD"
|
| "RELATIONSHIP_ADD"
|
||||||
| "RELATIONSHIP_REMOVE"
|
| "RELATIONSHIP_REMOVE"
|
||||||
| "SESSIONS_REPLACE"
|
| "SESSIONS_REPLACE"
|
||||||
|
| "USER_SETTINGS_PROTO_UPDATE"
|
||||||
| CUSTOMEVENTS;
|
| CUSTOMEVENTS;
|
||||||
|
|
||||||
export type CUSTOMEVENTS = "INVALIDATED" | "RATELIMIT";
|
export type CUSTOMEVENTS = "INVALIDATED" | "RATELIMIT";
|
||||||
|
|||||||
Reference in New Issue
Block a user