mirror of
https://github.com/sismics/docs.git
synced 2025-12-13 01:36:18 +00:00
Improve Inbox Scanning (#407)
closes #386: delete emails after import + closes #405: auto tag documents imported by email
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
api.current_version=${project.version}
|
||||
api.min_version=1.0
|
||||
db.version=24
|
||||
db.version=25
|
||||
@@ -328,6 +328,8 @@ public class AppResource extends BaseResource {
|
||||
|
||||
ConfigDao configDao = new ConfigDao();
|
||||
Boolean enabled = ConfigUtil.getConfigBooleanValue(ConfigType.INBOX_ENABLED);
|
||||
Boolean autoTags = ConfigUtil.getConfigBooleanValue(ConfigType.INBOX_AUTOMATIC_TAGS);
|
||||
Boolean deleteImported = ConfigUtil.getConfigBooleanValue(ConfigType.INBOX_DELETE_IMPORTED);
|
||||
Config hostnameConfig = configDao.getById(ConfigType.INBOX_HOSTNAME);
|
||||
Config portConfig = configDao.getById(ConfigType.INBOX_PORT);
|
||||
Config usernameConfig = configDao.getById(ConfigType.INBOX_USERNAME);
|
||||
@@ -336,6 +338,8 @@ public class AppResource extends BaseResource {
|
||||
JsonObjectBuilder response = Json.createObjectBuilder();
|
||||
|
||||
response.add("enabled", enabled);
|
||||
response.add("autoTagsEnabled", autoTags);
|
||||
response.add("deleteImported", deleteImported);
|
||||
if (hostnameConfig == null) {
|
||||
response.addNull("hostname");
|
||||
} else {
|
||||
@@ -405,6 +409,8 @@ public class AppResource extends BaseResource {
|
||||
@POST
|
||||
@Path("config_inbox")
|
||||
public Response configInbox(@FormParam("enabled") Boolean enabled,
|
||||
@FormParam("autoTagsEnabled") Boolean autoTagsEnabled,
|
||||
@FormParam("deleteImported") Boolean deleteImported,
|
||||
@FormParam("hostname") String hostname,
|
||||
@FormParam("port") String portStr,
|
||||
@FormParam("username") String username,
|
||||
@@ -422,6 +428,8 @@ public class AppResource extends BaseResource {
|
||||
// Just update the changed configuration
|
||||
ConfigDao configDao = new ConfigDao();
|
||||
configDao.update(ConfigType.INBOX_ENABLED, enabled.toString());
|
||||
configDao.update(ConfigType.INBOX_AUTOMATIC_TAGS, autoTagsEnabled.toString());
|
||||
configDao.update(ConfigType.INBOX_DELETE_IMPORTED, deleteImported.toString());
|
||||
if (!Strings.isNullOrEmpty(hostname)) {
|
||||
configDao.update(ConfigType.INBOX_HOSTNAME, hostname);
|
||||
}
|
||||
|
||||
@@ -432,7 +432,9 @@
|
||||
"last_sync": "Last synchronization: {{ data.date | date: 'medium' }}, {{ data.count }} message{{ data.count > 1 ? 's' : '' }} imported",
|
||||
"test_success": "The connection to the inbox is successful ({{ count }} <strong>unread</strong> message{{ count > 1 ? 's' : '' }})",
|
||||
"test_fail": "An error occurred while connecting to the inbox, please check the parameters",
|
||||
"saved": "IMAP configuration saved successfully"
|
||||
"saved": "IMAP configuration saved successfully",
|
||||
"autoTagsEnabled": "Automatically add tags from subject line marked with #",
|
||||
"deleteImported": "Delete message from mailbox after import"
|
||||
},
|
||||
"monitoring": {
|
||||
"background_tasks": "Background tasks",
|
||||
|
||||
@@ -17,6 +17,20 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="inboxAutoTagsEnabled">{{ 'settings.inbox.autoTagsEnabled' | translate }}</label>
|
||||
<div class="col-sm-7">
|
||||
<input name="autoTagsEnabled" type="checkbox" id="inboxAutoTagsEnabled" ng-model="inbox.autoTagsEnabled" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="inboxDeleteImported">{{ 'settings.inbox.deleteImported' | translate }}</label>
|
||||
<div class="col-sm-7">
|
||||
<input name="deleteImported" type="checkbox" id="inboxDeleteImported" ng-model="inbox.deleteImported" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" ng-class="{ 'has-error': !inboxForm.hostname.$valid && inboxForm.$dirty }">
|
||||
<label class="col-sm-2 control-label" for="inboxHostname">{{ 'settings.inbox.hostname' | translate }}</label>
|
||||
<div class="col-sm-7">
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
api.current_version=${project.version}
|
||||
api.min_version=1.0
|
||||
db.version=24
|
||||
db.version=25
|
||||
@@ -1,3 +1,3 @@
|
||||
api.current_version=${project.version}
|
||||
api.min_version=1.0
|
||||
db.version=24
|
||||
db.version=25
|
||||
@@ -254,6 +254,8 @@ public class TestAppResource extends BaseJerseyTest {
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, adminToken)
|
||||
.post(Entity.form(new Form()
|
||||
.param("enabled", "true")
|
||||
.param("autoTagsEnabled", "false")
|
||||
.param("deleteImported", "false")
|
||||
.param("hostname", "localhost")
|
||||
.param("port", "9755")
|
||||
.param("username", "test@sismics.com")
|
||||
|
||||
Reference in New Issue
Block a user