1 /* 2 * Make.org Core API 3 * Copyright (C) 2018 Make.org 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU Affero General Public License as 7 * published by the Free Software Foundation, either version 3 of the 8 * License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Affero General Public License for more details. 14 * 15 * You should have received a copy of the GNU Affero General Public License 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package org.make.api.proposal 21 22 import com.typesafe.config.Config 23 import org.make.api.technical.ActorSystemComponent 24 import org.make.api.extensions.ConfigurationSupport 25 import akka.actor.typed.{ActorSystem, Extension, ExtensionId} 26 27 class MaxPropositionsThresholds(override protected val configuration: Config) 28 extends Extension 29 with ConfigurationSupport { 30 31 val warnThreshold: Int = configuration.getInt("warn") 32 val blockThreshold: Int = configuration.getInt("block") 33 } 34 35 object MaxPropositionsThresholds extends ExtensionId[MaxPropositionsThresholds] { 36 37 override def createExtension(system: ActorSystem[_]): MaxPropositionsThresholds = 38 new MaxPropositionsThresholds(system.settings.config.getConfig("make-api.user-proposals-thresholds")) 39 } 40 41 trait MaxPropositionsThresholdsComponent { 42 def maxPropositionsThresholds: MaxPropositionsThresholds 43 } 44 45 trait DefaultMaxPropositionsThresholdsComponent extends MaxPropositionsThresholdsComponent { 46 this: ActorSystemComponent => 47 48 override lazy val maxPropositionsThresholds: MaxPropositionsThresholds = 49 MaxPropositionsThresholds(actorSystem) 50 }
| Line | Stmt Id | Pos | Tree | Symbol | Tests | Code |
|---|---|---|---|---|---|---|
| 31 | 7333 | 1136 - 1164 | Apply | com.typesafe.config.Config.getInt | MaxPropositionsThresholds.this.configuration.getInt("warn") | |
| 32 | 6546 | 1193 - 1222 | Apply | com.typesafe.config.Config.getInt | MaxPropositionsThresholds.this.configuration.getInt("block") | |
| 38 | 5674 | 1427 - 1497 | Apply | com.typesafe.config.Config.getConfig | system.settings.config.getConfig("make-api.user-proposals-thresholds") | |
| 38 | 7500 | 1397 - 1498 | Apply | org.make.api.proposal.MaxPropositionsThresholds.<init> | new MaxPropositionsThresholds(system.settings.config.getConfig("make-api.user-proposals-thresholds")) |