diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-02-24 17:57:49 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-02-24 17:57:49 +0900 |
| commit | f4ae9391248d9ba366210be215681537ce9ecb49 (patch) | |
| tree | 28de199e28cf57ea5254da4c1f300e16b3996a5f /src/server/api/endpoints/i/update-client-setting.ts | |
| parent | Refactor (diff) | |
| download | misskey-f4ae9391248d9ba366210be215681537ce9ecb49.tar.gz misskey-f4ae9391248d9ba366210be215681537ce9ecb49.tar.bz2 misskey-f4ae9391248d9ba366210be215681537ce9ecb49.zip | |
ハイフンに統一
Diffstat (limited to 'src/server/api/endpoints/i/update-client-setting.ts')
| -rw-r--r-- | src/server/api/endpoints/i/update-client-setting.ts | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/server/api/endpoints/i/update-client-setting.ts b/src/server/api/endpoints/i/update-client-setting.ts new file mode 100644 index 0000000000..79cd04e169 --- /dev/null +++ b/src/server/api/endpoints/i/update-client-setting.ts @@ -0,0 +1,37 @@ +import $ from 'cafy'; +import User from '../../../../models/user'; +import { publishMainStream } from '../../../../services/stream'; +import define from '../../define'; + +export const meta = { + requireCredential: true, + + secure: true, + + params: { + name: { + validator: $.str + }, + + value: { + validator: $.nullable.any + } + } +}; + +export default define(meta, async (ps, user) => { + const x: any = {}; + x[`clientSettings.${ps.name}`] = ps.value; + + await User.update(user._id, { + $set: x + }); + + // Publish event + publishMainStream(user._id, 'clientSettingUpdated', { + key: ps.name, + value: ps.value + }); + + return; +}); |