forked from FoundKeyGang/FoundKey
Fix bug
This commit is contained in:
parent
d4f245f51c
commit
9595f43d01
2 changed files with 17 additions and 16 deletions
|
@ -32,6 +32,16 @@ module.exports = async (params, user, _, isSecure) =>
|
||||||
user.name = name;
|
user.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get 'description' parameter
|
||||||
|
const description = params.description;
|
||||||
|
if (description !== undefined && description !== null) {
|
||||||
|
if (description.length > 500) {
|
||||||
|
return rej('too long description');
|
||||||
|
}
|
||||||
|
|
||||||
|
user.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
// Get 'location' parameter
|
// Get 'location' parameter
|
||||||
const location = params.location;
|
const location = params.location;
|
||||||
if (location !== undefined && location !== null) {
|
if (location !== undefined && location !== null) {
|
||||||
|
@ -42,16 +52,6 @@ module.exports = async (params, user, _, isSecure) =>
|
||||||
user.profile.location = location;
|
user.profile.location = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get 'bio' parameter
|
|
||||||
const bio = params.bio;
|
|
||||||
if (bio !== undefined && bio !== null) {
|
|
||||||
if (bio.length > 500) {
|
|
||||||
return rej('too long bio');
|
|
||||||
}
|
|
||||||
|
|
||||||
user.profile.bio = bio;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get 'birthday' parameter
|
// Get 'birthday' parameter
|
||||||
const birthday = params.birthday;
|
const birthday = params.birthday;
|
||||||
if (birthday != null) {
|
if (birthday != null) {
|
||||||
|
@ -79,6 +79,7 @@ module.exports = async (params, user, _, isSecure) =>
|
||||||
await User.update(user._id, {
|
await User.update(user._id, {
|
||||||
$set: {
|
$set: {
|
||||||
name: user.name,
|
name: user.name,
|
||||||
|
description: user.description,
|
||||||
avatar_id: user.avatar_id,
|
avatar_id: user.avatar_id,
|
||||||
banner_id: user.banner_id,
|
banner_id: user.banner_id,
|
||||||
profile: user.profile
|
profile: user.profile
|
||||||
|
|
|
@ -23,15 +23,15 @@
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<p>場所</p>
|
<p>場所</p>
|
||||||
<input ref="accountLocation" type="text" value={ I.location }/>
|
<input ref="accountLocation" type="text" value={ I.profile.location }/>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<p>自己紹介</p>
|
<p>自己紹介</p>
|
||||||
<textarea ref="accountBio">{ I.bio }</textarea>
|
<textarea ref="accountDescription">{ I.description }</textarea>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<p>誕生日</p>
|
<p>誕生日</p>
|
||||||
<input ref="accountBirthday" type="date" value={ I.birthday }/>
|
<input ref="accountBirthday" type="date" value={ I.profile.birthday }/>
|
||||||
</label>
|
</label>
|
||||||
<button class="style-primary" onclick={ updateAccount }>保存</button>
|
<button class="style-primary" onclick={ updateAccount }>保存</button>
|
||||||
</section>
|
</section>
|
||||||
|
@ -212,9 +212,9 @@
|
||||||
this.updateAccount = () => {
|
this.updateAccount = () => {
|
||||||
this.api('i/update', {
|
this.api('i/update', {
|
||||||
name: this.refs.accountName.value,
|
name: this.refs.accountName.value,
|
||||||
location: this.refs.accountLocation.value,
|
location: this.refs.accountLocation.value || undefined,
|
||||||
bio: this.refs.accountBio.value,
|
description: this.refs.accountDescription.value || undefined,
|
||||||
birthday: this.refs.accountBirthday.value
|
birthday: this.refs.accountBirthday.value || undefined
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.notify('プロフィールを更新しました');
|
this.notify('プロフィールを更新しました');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue