Skip to content
Open
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
4 changes: 4 additions & 0 deletions src/main/kotlin/org/gitanimals/core/Svgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ val largetTextAcceptableChars = lazy {
acceptableTitles.toList()
}.value

val forbiddenWordsList = lazy {
listOf("fuck", "shit", "hate", "bitch")
}.value
Comment on lines +369 to +371
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forbiddenWordsList가 core의 Svgs안에서 관리되는것 같은데요.
gitanimals에서는 Svgs안에 Svg관련 데이터만 넣고 있습니다.

추가로, forbiddenWordsList는 Guild생성시에만 사용되는데이터로 Guild안에 있어야할거 같아요.


별개로, 불가능한 단어를 정적으로 관리하는 방식은 지속가능한 방식이 아닙니다.
새로운 불가능한 단어가 추가될때마다, 개발자가 forbiddenWordsList에 내용을 추가하고 서버를 재배포 해야하니까요.

따라서, 말씀해주신것 처럼 api를 이용한 방식을 차용해야 할거 같습니다.


다만, 이 방식은 api 토큰등 내부 작업이 필요해보여서 outside collaborator가 하기에는 조금 무리가 있을거라고 생각합니다.
제가 시간이 날때 요 PR에 현재 작업해주신 내용과 관련 내용을 함께 작업해서 collaborator로 넣어드리는 방향을 생각하고 있는데 어떻게 생각하시나요?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그래주시면 감사하겠습니다.
제 의견을 긍정적으로 받아들여 주셔서 감사합니다.


val mediumNumberSvgs = lazy {
val list = mutableListOf<String>()
for (i in 0..9) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.gitanimals.guild.app.request

import org.gitanimals.core.FieldType
import org.gitanimals.core.forbiddenWordsList
import org.gitanimals.core.largetTextAcceptableChars

data class CreateGuildRequest(
Expand All @@ -16,5 +17,9 @@ data class CreateGuildRequest(
title.forEach {
require(it in largetTextAcceptableChars) { "Cannot accept title \"$it\"" }
}

require(forbiddenWordsList.none { title.contains(it, ignoreCase = true) }) {
"Title contains forbidden word. title: \"$title\""
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.gitanimals.guild.domain.request

import org.gitanimals.core.FieldType
import org.gitanimals.core.forbiddenWordsList
import org.gitanimals.core.largetTextAcceptableChars

data class ChangeGuildRequest(
Expand All @@ -15,5 +16,9 @@ data class ChangeGuildRequest(
title.forEach {
require(it in largetTextAcceptableChars) { "Cannot accept title \"$it\"" }
}

require(forbiddenWordsList.none { title.contains(it, ignoreCase = true) }) {
"Title contains forbidden word. title: \"$title\""
}
}
}