mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-14 11:48:16 +00:00
added setup command which includes an interactive process in order to setup features
the current supported features are post targets and system config the wizard includes a summary step where the user can confirm the changes removed some unnecessary validators, which were basically just validating the system config from some features fixed post target name
This commit is contained in:
@@ -44,7 +44,7 @@ public class MyWarnings extends AbstractConditionableCommand {
|
||||
model.setCurrentWarnCount(currentWarnCount);
|
||||
Long totalWarnCount = warnManagementService.getTotalWarnsForUser(commandContext.getUserInitiatedContext().getAUserInAServer());
|
||||
model.setTotalWarnCount(totalWarnCount);
|
||||
channelService.sendTemplateInChannel("myWarnings_response", model, commandContext.getChannel());
|
||||
channelService.sendEmbedTemplateInChannel("myWarnings_response", model, commandContext.getChannel());
|
||||
return CommandResult.fromSuccess();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class UserNotes extends AbstractConditionableCommand {
|
||||
userNotes = userNoteManagementService.loadNotesForServer(commandContext.getUserInitiatedContext().getServer());
|
||||
}
|
||||
model.setUserNotes(userNotesConverter.fromNotes(userNotes));
|
||||
channelService.sendTemplateInChannel("user_notes_response", model, commandContext.getChannel());
|
||||
channelService.sendEmbedTemplateInChannel("user_notes_response", model, commandContext.getChannel());
|
||||
return CommandResult.fromSuccess();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package dev.sheldan.abstracto.moderation.validator;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||
import dev.sheldan.abstracto.core.models.FeatureValidationResult;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.abstracto.core.service.FeatureValidatorService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class WarnDecayFeatureValidatorBean implements WarnDecayFeatureValidator {
|
||||
|
||||
@Autowired
|
||||
private FeatureValidatorService featureValidatorService;
|
||||
|
||||
@Override
|
||||
public void featureIsSetup(FeatureConfig featureConfig, AServer server, FeatureValidationResult validationResult) {
|
||||
featureValidatorService.checkSystemConfig("decayDays", server, validationResult);
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,7 @@ package dev.sheldan.abstracto.moderation.config.features;
|
||||
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||
import dev.sheldan.abstracto.core.config.FeatureEnum;
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import dev.sheldan.abstracto.core.service.FeatureValidator;
|
||||
import dev.sheldan.abstracto.moderation.config.posttargets.WarnDecayPostTarget;
|
||||
import dev.sheldan.abstracto.moderation.validator.WarnDecayFeatureValidator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -18,14 +16,17 @@ public class WarningDecayFeature implements FeatureConfig {
|
||||
@Autowired
|
||||
private WarningFeature warningFeature;
|
||||
|
||||
@Autowired
|
||||
private WarnDecayFeatureValidator warnDecayFeatureValidator;
|
||||
|
||||
@Override
|
||||
public FeatureEnum getFeature() {
|
||||
return ModerationFeatures.AUTOMATIC_WARN_DECAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getRequiredSystemConfigKeys() {
|
||||
return Arrays.asList("decayDays");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FeatureConfig> getRequiredFeatures() {
|
||||
return Arrays.asList(warningFeature);
|
||||
@@ -36,8 +37,4 @@ public class WarningDecayFeature implements FeatureConfig {
|
||||
return Arrays.asList(WarnDecayPostTarget.DECAY_LOG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FeatureValidator> getAdditionalFeatureValidators() {
|
||||
return Arrays.asList(warnDecayFeatureValidator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum LoggingPostTarget implements PostTargetEnum {
|
||||
LEAVE_LOG("muteLog"), JOIN_LOG("joinLog"), DELETE_LOG("deleteLog"), EDIT_LOG("editLog");
|
||||
LEAVE_LOG("leaveLog"), JOIN_LOG("joinLog"), DELETE_LOG("deleteLog"), EDIT_LOG("editLog");
|
||||
|
||||
private String key;
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
package dev.sheldan.abstracto.moderation.validator;
|
||||
|
||||
import dev.sheldan.abstracto.core.service.FeatureValidator;
|
||||
|
||||
public interface WarnDecayFeatureValidator extends FeatureValidator {
|
||||
}
|
||||
Reference in New Issue
Block a user