Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

displayNameのバグの修正 #282

Merged
merged 3 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/UI/ServiceAccordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const value = computed({
const options = computed(() =>
serviceArray
.filter(s => !props.registered.includes(s.type))
// TODO: https://github.com/traPtitech/traPortfolio-Dashboard/issues/283 のための暫定的な対応
.filter(s => s.type !== 1)
.map(s => ({ label: s.name, value: s.name }))
)
</script>
Expand Down
10 changes: 9 additions & 1 deletion src/pages/UserAccountEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ const canSubmit = computed(
const updateAccount = async () => {
isSending.value = true
try {
await apis.editUserAccount(me.id, accountId.value, formValues.value)
// FIXME: https://github.com/traPtitech/traPortfolio-Dashboard/issues/71
// 暫定的にHomePageとBlogのときはdisplayNameにユーザー名を入れておく
const _formValues = {
...formValues.value,
displayName: [0, 1].includes(formValues.value.type)
? me.name
: formValues.value.displayName
}
await apis.editUserAccount(me.id, accountId.value, _formValues)
toast.success('アカウント情報を更新しました')
router.push('/user/accounts')
} catch {
Expand Down
21 changes: 18 additions & 3 deletions src/pages/UserAccountNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import LabeledForm from '/@/components/Form/LabeledForm.vue'
import FormInput from '/@/components/UI/FormInput.vue'
import ToggleSwitch from '/@/components/UI/ToggleSwitch.vue'
import ServiceAccordion from '/@/components/UI/ServiceAccordion.vue'
import { hasAtmarkService, hasIdService } from '/@/consts/services'
import {
hasAtmarkService,
hasIdService,
serviceArray
} from '/@/consts/services'
import { isValidLength, isValidUrl } from '/@/lib/validate'
import { useToast } from 'vue-toastification'

Expand All @@ -22,7 +26,10 @@ const registeredServices = computed(() =>
)

const formValues = reactive<AddAccountRequest>({
type: 0,
type:
serviceArray
.filter(s => !registeredServices.value.includes(s.type))
.map(s => s.type)[0] ?? 0,
displayName: '',
url: '',
prPermitted: false
Expand All @@ -41,7 +48,15 @@ const canSubmit = computed(
const createNewAccount = async () => {
isSending.value = true
try {
await apis.addUserAccount(me.id, formValues)
// FIXME: https://github.com/traPtitech/traPortfolio-Dashboard/issues/71
// 暫定的にHomePageとBlogのときはdisplayNameにユーザー名を入れておく
const _formValues = {
...formValues,
displayName: [0, 1].includes(formValues.type)
? me.name
: formValues.displayName
}
await apis.addUserAccount(me.id, _formValues)
toast.success('アカウント情報を登録しました')
router.push('/user/accounts')
} catch {
Expand Down
Loading