summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-02-23 17:19:52 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-02-23 17:19:52 +0900
commit9595f43d014a0170552de25e4efc744b52c6704c (patch)
tree2f74fe4e8f60aa438d1a640ce1deca847e94f1d7 /src
parent[Client] Fix bug (diff)
downloadsharkey-9595f43d014a0170552de25e4efc744b52c6704c.tar.gz
sharkey-9595f43d014a0170552de25e4efc744b52c6704c.tar.bz2
sharkey-9595f43d014a0170552de25e4efc744b52c6704c.zip
Fix bug
Diffstat (limited to 'src')
-rw-r--r--src/api/endpoints/i/update.js21
-rw-r--r--src/web/app/desktop/tags/settings.tag12
2 files changed, 17 insertions, 16 deletions
diff --git a/src/api/endpoints/i/update.js b/src/api/endpoints/i/update.js
index 5aeafa60c8..cd8f9b49d8 100644
--- a/src/api/endpoints/i/update.js
+++ b/src/api/endpoints/i/update.js
@@ -32,6 +32,16 @@ module.exports = async (params, user, _, isSecure) =>
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
const location = params.location;
if (location !== undefined && location !== null) {
@@ -42,16 +52,6 @@ module.exports = async (params, user, _, isSecure) =>
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
const birthday = params.birthday;
if (birthday != null) {
@@ -79,6 +79,7 @@ module.exports = async (params, user, _, isSecure) =>
await User.update(user._id, {
$set: {
name: user.name,
+ description: user.description,
avatar_id: user.avatar_id,
banner_id: user.banner_id,
profile: user.profile
diff --git a/src/web/app/desktop/tags/settings.tag b/src/web/app/desktop/tags/settings.tag
index 544e41c256..56a00bc9ad 100644
--- a/src/web/app/desktop/tags/settings.tag
+++ b/src/web/app/desktop/tags/settings.tag
@@ -23,15 +23,15 @@
</label>
<label>
<p>場所</p>
- <input ref="accountLocation" type="text" value={ I.location }/>
+ <input ref="accountLocation" type="text" value={ I.profile.location }/>
</label>
<label>
<p>自己紹介</p>
- <textarea ref="accountBio">{ I.bio }</textarea>
+ <textarea ref="accountDescription">{ I.description }</textarea>
</label>
<label>
<p>誕生日</p>
- <input ref="accountBirthday" type="date" value={ I.birthday }/>
+ <input ref="accountBirthday" type="date" value={ I.profile.birthday }/>
</label>
<button class="style-primary" onclick={ updateAccount }>保存</button>
</section>
@@ -212,9 +212,9 @@
this.updateAccount = () => {
this.api('i/update', {
name: this.refs.accountName.value,
- location: this.refs.accountLocation.value,
- bio: this.refs.accountBio.value,
- birthday: this.refs.accountBirthday.value
+ location: this.refs.accountLocation.value || undefined,
+ description: this.refs.accountDescription.value || undefined,
+ birthday: this.refs.accountBirthday.value || undefined
}).then(() => {
this.notify('プロフィールを更新しました');
});