From 1ce5ba4f0601ba8b98f7b314670cfa09b41da7fe Mon Sep 17 00:00:00 2001 From: Benjamin Gamard Date: Wed, 28 Feb 2018 13:08:30 +0100 Subject: [PATCH] #180: expain that only unread emails will be imported, fix logo display --- .../java/com/sismics/docs/core/service/InboxService.java | 3 ++- docs-web/src/main/webapp/src/index.html | 2 +- docs-web/src/main/webapp/src/locale/en.json | 6 +++--- .../src/main/webapp/src/partial/docs/settings.inbox.html | 4 +++- docs-web/src/main/webapp/src/style/main.less | 2 ++ 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs-core/src/main/java/com/sismics/docs/core/service/InboxService.java b/docs-core/src/main/java/com/sismics/docs/core/service/InboxService.java index 2df5c6e5..a7bc1ecd 100644 --- a/docs-core/src/main/java/com/sismics/docs/core/service/InboxService.java +++ b/docs-core/src/main/java/com/sismics/docs/core/service/InboxService.java @@ -18,6 +18,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.mail.*; +import javax.mail.search.FlagTerm; import java.util.Date; import java.util.Properties; import java.util.concurrent.TimeUnit; @@ -114,7 +115,7 @@ public class InboxService extends AbstractScheduledService { Folder inbox = null; try { inbox = openInbox(); - return inbox.getMessageCount(); + return inbox.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false)).length; } catch (Exception e) { log.error("Error testing inbox", e); return -1; diff --git a/docs-web/src/main/webapp/src/index.html b/docs-web/src/main/webapp/src/index.html index 77aff9d3..303592ea 100644 --- a/docs-web/src/main/webapp/src/index.html +++ b/docs-web/src/main/webapp/src/index.html @@ -118,7 +118,7 @@ Sismics Docs - {{ appName }} + {{ appName }} diff --git a/docs-web/src/main/webapp/src/locale/en.json b/docs-web/src/main/webapp/src/locale/en.json index ba2e90d7..c592b965 100644 --- a/docs-web/src/main/webapp/src/locale/en.json +++ b/docs-web/src/main/webapp/src/locale/en.json @@ -363,7 +363,7 @@ }, "inbox": { "title": "Inbox scanning", - "message": "By enabling this feature, the system while periodically scan the specified inbox for new emails and automatically import them.", + "message": "By enabling this feature, the system will scan the specified inbox every 15 minutes for unread emails and automatically import them.
After importing an email, it will be marked as read.
Configuration settings for Gmail, Outlook.com, Yahoo.", "enabled": "Enable inbox scanning", "hostname": "IMAP hostname", "port": "IMAP port (143 or 993)", @@ -371,8 +371,8 @@ "password": "IMAP password", "tag": "Tag added to imported documents", "test": "Test the parameters", - "last_sync": "Last synchronization: {{ data.date | date }}, {{ data.count }} message{{ data.count > 1 ? 's' : '' }} imported", - "test_success": "The connection to the inbox is successful ({{ count }} message{{ count > 1 ? 's' : '' }})", + "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 }} unread message{{ count > 1 ? 's' : '' }})", "test_fail": "An error occurred while connecting to the inbox, please check the parameters" }, "log": { diff --git a/docs-web/src/main/webapp/src/partial/docs/settings.inbox.html b/docs-web/src/main/webapp/src/partial/docs/settings.inbox.html index 75e01924..e6d06e08 100644 --- a/docs-web/src/main/webapp/src/partial/docs/settings.inbox.html +++ b/docs-web/src/main/webapp/src/partial/docs/settings.inbox.html @@ -73,4 +73,6 @@
{{ testResult.count >= 0 ? 'settings.inbox.test_success' : 'settings.inbox.test_fail' | translate: { count: testResult.count } }}
\ No newline at end of file + ng-show="testResult" + translate="{{ testResult.count >= 0 ? 'settings.inbox.test_success' : 'settings.inbox.test_fail' }}" + translate-values="{ count: testResult.count }"> \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/style/main.less b/docs-web/src/main/webapp/src/style/main.less index fa83e8cf..71fdcfdf 100644 --- a/docs-web/src/main/webapp/src/style/main.less +++ b/docs-web/src/main/webapp/src/style/main.less @@ -1,9 +1,11 @@ // Logo .navbar-logo { margin: 3px; + img { width: 44px; height: 44px; + border-radius: 50%; } }