fix #95, ignore expired keyword filter
This commit is contained in:
parent
5295f06439
commit
f25af9ff46
|
@ -6,7 +6,7 @@ import org.junit.Test
|
|||
import org.junit.runner.RunWith
|
||||
|
||||
import jp.juggler.subwaytooter.util.CharacterGroup
|
||||
import jp.juggler.subwaytooter.util.WordTrieTree
|
||||
import jp.juggler.util.WordTrieTree
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotNull
|
||||
|
|
|
@ -16,7 +16,7 @@ import jp.juggler.subwaytooter.table.*
|
|||
import jp.juggler.subwaytooter.util.BucketList
|
||||
import jp.juggler.subwaytooter.util.InstanceTicker
|
||||
import jp.juggler.subwaytooter.util.ScrollPosition
|
||||
import jp.juggler.subwaytooter.util.WordTrieTree
|
||||
import jp.juggler.util.WordTrieTree
|
||||
import jp.juggler.util.*
|
||||
import okhttp3.Handshake
|
||||
import org.jetbrains.anko.backgroundDrawable
|
||||
|
@ -7103,10 +7103,13 @@ class Column(
|
|||
val column_context = getFilterContext()
|
||||
if(column_context == 0 || filterList == null) return null
|
||||
val tree = WordTrieTree()
|
||||
val now = System.currentTimeMillis()
|
||||
for(filter in filterList) {
|
||||
if(filter.time_expires_at > 0L && now >= filter.time_expires_at) continue
|
||||
if((filter.context and column_context) != 0) {
|
||||
tree.add(
|
||||
filter.phrase, validator = when(filter.whole_word) {
|
||||
filter.phrase,
|
||||
validator = when(filter.whole_word) {
|
||||
true -> WordTrieTree.WORD_VALIDATOR
|
||||
else -> WordTrieTree.EMPTY_VALIDATOR
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import android.os.Handler
|
|||
import jp.juggler.subwaytooter.api.*
|
||||
import jp.juggler.subwaytooter.api.entity.*
|
||||
import jp.juggler.subwaytooter.table.SavedAccount
|
||||
import jp.juggler.subwaytooter.util.WordTrieTree
|
||||
import jp.juggler.util.WordTrieTree
|
||||
import jp.juggler.util.LogCategory
|
||||
import jp.juggler.util.runOnMainLooper
|
||||
import jp.juggler.util.toJsonObject
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package jp.juggler.subwaytooter.api
|
||||
|
||||
import android.content.Context
|
||||
import jp.juggler.subwaytooter.Pref
|
||||
import jp.juggler.subwaytooter.api.entity.*
|
||||
import jp.juggler.subwaytooter.table.UserRelation
|
||||
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
|
||||
import jp.juggler.subwaytooter.util.WordTrieTree
|
||||
import jp.juggler.util.WordTrieTree
|
||||
import jp.juggler.subwaytooter.util.LinkHelper
|
||||
import jp.juggler.util.parseString
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import android.database.sqlite.SQLiteDatabase
|
|||
import org.json.JSONObject
|
||||
|
||||
import jp.juggler.subwaytooter.App1
|
||||
import jp.juggler.subwaytooter.util.*
|
||||
import jp.juggler.util.*
|
||||
|
||||
class HighlightWord {
|
||||
|
|
|
@ -6,7 +6,7 @@ import android.database.sqlite.SQLiteDatabase
|
|||
|
||||
import jp.juggler.subwaytooter.App1
|
||||
import jp.juggler.util.LogCategory
|
||||
import jp.juggler.subwaytooter.util.WordTrieTree
|
||||
import jp.juggler.util.WordTrieTree
|
||||
|
||||
object MutedWord :TableCompanion{
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import jp.juggler.subwaytooter.api.entity.CustomEmoji
|
|||
import jp.juggler.subwaytooter.api.entity.NicoProfileEmoji
|
||||
import jp.juggler.subwaytooter.api.entity.TootAttachmentLike
|
||||
import jp.juggler.subwaytooter.table.HighlightWord
|
||||
import jp.juggler.util.WordTrieTree
|
||||
import java.util.HashMap
|
||||
|
||||
class DecodeOptions(
|
||||
|
|
|
@ -888,7 +888,7 @@ object MisskeyMarkdownDecoder {
|
|||
if(mentions.find { m -> m.acct == shortAcct } == null) {
|
||||
mentions.add(
|
||||
TootMention(
|
||||
jp.juggler.subwaytooter.api.entity.EntityId.Companion.DEFAULT
|
||||
jp.juggler.subwaytooter.api.entity.EntityId.DEFAULT
|
||||
, userUrl
|
||||
, shortAcct
|
||||
, username
|
||||
|
@ -1225,7 +1225,7 @@ object MisskeyMarkdownDecoder {
|
|||
}
|
||||
|
||||
// マークダウン要素
|
||||
class Node(
|
||||
internal class Node(
|
||||
val type : NodeType, // ノード種別
|
||||
val args : Array<String> = emptyArray(), // 引数
|
||||
parentNode : Node?
|
||||
|
@ -1240,7 +1240,7 @@ object MisskeyMarkdownDecoder {
|
|||
}
|
||||
|
||||
// マークダウン要素の出現位置
|
||||
class NodeDetected(
|
||||
internal class NodeDetected(
|
||||
val node : Node,
|
||||
val start : Int, // テキスト中の開始位置
|
||||
val end : Int, // テキスト中の終了位置
|
||||
|
@ -1253,7 +1253,7 @@ object MisskeyMarkdownDecoder {
|
|||
get() = startInside + lengthInside
|
||||
}
|
||||
|
||||
class NodeParseEnv(
|
||||
internal class NodeParseEnv(
|
||||
private val parentNode : Node,
|
||||
val text : String,
|
||||
start : Int,
|
||||
|
@ -1337,7 +1337,7 @@ object MisskeyMarkdownDecoder {
|
|||
closeText(end)
|
||||
}
|
||||
|
||||
fun makeDetected(
|
||||
internal fun makeDetected(
|
||||
type : NodeType,
|
||||
args : Array<String>,
|
||||
start : Int,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package jp.juggler.subwaytooter.util
|
||||
package jp.juggler.util
|
||||
|
||||
import android.support.v4.util.SparseArrayCompat
|
||||
import jp.juggler.subwaytooter.util.CharacterGroup
|
||||
|
||||
import java.util.ArrayList
|
||||
|
Loading…
Reference in New Issue