style: fix lint

This commit is contained in:
usbharu 2024-02-12 12:36:23 +09:00
parent 41d1e59322
commit 7189159cb0
15 changed files with 15 additions and 19 deletions

View File

@ -3,4 +3,4 @@ package dev.usbharu.hideout.core.domain.model.filter
enum class FilterAction {
warn,
hide
}
}

View File

@ -4,4 +4,4 @@ enum class FilterMode {
WHOLE_WORD,
REGEX,
NONE
}
}

View File

@ -11,4 +11,4 @@ interface FilterRepository {
suspend fun deleteById(id: Long)
suspend fun deleteByUserIdAndId(userId: Long, id: Long)
}
}

View File

@ -6,4 +6,4 @@ enum class FilterType {
public,
thread,
account
}
}

View File

@ -7,4 +7,4 @@ data class FilterKeyword(
val filterId: Long,
val keyword: String,
val mode: FilterMode
)
)

View File

@ -7,4 +7,4 @@ interface FilterKeywordRepository {
suspend fun findById(id: Long): FilterKeyword?
suspend fun deleteById(id: Long)
suspend fun deleteByFilterId(filterId: Long)
}
}

View File

@ -79,4 +79,4 @@ object FilterKeywords : Table() {
val mode = varchar("mode", 100)
override val primaryKey: PrimaryKey = PrimaryKey(id)
}
}

View File

@ -23,4 +23,4 @@ data class FilterQueryModel(
keywords
)
}
}
}

View File

@ -7,4 +7,4 @@ interface FilterQueryService {
suspend fun findByUserId(userId: Long): List<FilterQueryModel>
suspend fun findByUserIdAndId(userId: Long, id: Long): FilterQueryModel?
suspend fun findByUserIdAndKeywordId(userId: Long, keywordId: Long): FilterQueryModel?
}
}

View File

@ -11,4 +11,4 @@ interface MuteProcessService {
context: List<FilterType>,
filters: List<FilterQueryModel>
): Map<Post, FilterResult>
}
}

View File

@ -71,7 +71,6 @@ class MuteProcessServiceImpl : MuteProcessService {
it,
precompileRegex(it)
)
}
return filterQueryModelList
@ -93,11 +92,9 @@ class MuteProcessServiceImpl : MuteProcessService {
}
}
val noneRegex = noneRegexStrings.joinToString("|", "(", ")")
val wholeRegex = wholeRegexStrings.joinToString("|", "\\b(", ")\\b")
val regex = if (noneRegexStrings.isNotEmpty() && wholeRegexStrings.isNotEmpty()) {
Regex("$noneRegex|$wholeRegex")
} else if (noneRegexStrings.isNotEmpty()) {
@ -123,4 +120,4 @@ class MuteProcessServiceImpl : MuteProcessService {
companion object {
private val logger = LoggerFactory.getLogger(MuteProcessServiceImpl::class.java)
}
}
}

View File

@ -16,4 +16,4 @@ interface MuteService {
suspend fun getFilters(userId: Long, types: List<FilterType> = emptyList()): List<FilterQueryModel>
suspend fun deleteFilter(filterId: Long)
}
}

View File

@ -52,4 +52,4 @@ class MuteServiceImpl(
filterKeywordRepository.deleteByFilterId(filterId)
filterRepository.deleteById(filterId)
}
}
}

View File

@ -2,7 +2,6 @@ package dev.usbharu.hideout.mastodon.interfaces.api.filter
import dev.usbharu.hideout.controller.mastodon.generated.FilterApi
import dev.usbharu.hideout.domain.mastodon.model.generated.*
import kotlinx.coroutines.flow.Flow
import org.springframework.http.ResponseEntity
import org.springframework.stereotype.Controller
@ -95,4 +94,4 @@ class MastodonFilterApiController : FilterApi {
override suspend fun apiV2FiltersStatusesIdGet(id: String): ResponseEntity<FilterStatus> {
return super.apiV2FiltersStatusesIdGet(id)
}
}
}

View File

@ -285,4 +285,4 @@ class MastodonFilterApiServiceImpl(
override suspend fun getFilterStatusById(userId: Long, filterPostsId: Long): FilterStatus? {
return null
}
}
}