#180: expain that only unread emails will be imported, fix logo display

This commit is contained in:
Benjamin Gamard 2018-02-28 13:08:30 +01:00
parent 2b23a1d048
commit 1ce5ba4f06
5 changed files with 11 additions and 6 deletions

View File

@ -18,6 +18,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.mail.*; import javax.mail.*;
import javax.mail.search.FlagTerm;
import java.util.Date; import java.util.Date;
import java.util.Properties; import java.util.Properties;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -114,7 +115,7 @@ public class InboxService extends AbstractScheduledService {
Folder inbox = null; Folder inbox = null;
try { try {
inbox = openInbox(); inbox = openInbox();
return inbox.getMessageCount(); return inbox.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false)).length;
} catch (Exception e) { } catch (Exception e) {
log.error("Error testing inbox", e); log.error("Error testing inbox", e);
return -1; return -1;

View File

@ -118,7 +118,7 @@
<span ng-if="appName == 'Sismics Docs'"> <span ng-if="appName == 'Sismics Docs'">
<span style="color: #e43935;">Sismics</span> <span style="color: #2aabd2;">Docs</span> <span style="color: #e43935;">Sismics</span> <span style="color: #2aabd2;">Docs</span>
</span> </span>
<span ng-if="appName != 'Sismics Docs'">{{ appName }}</span> <span ng-if="appName != 'Sismics Docs'" style="color: #888;">{{ appName }}</span>
</a> </a>
</div> </div>

View File

@ -363,7 +363,7 @@
}, },
"inbox": { "inbox": {
"title": "Inbox scanning", "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 <strong>unread</strong> emails and automatically import them.<br/>After importing an email, it will be marked as read.<br/>Configuration settings for <a href=\"https://support.google.com/mail/answer/7126229?hl=en\" target=\"_blank\">Gmail</a>, <a href=\"https://support.office.com/en-us/article/pop-imap-and-smtp-settings-for-outlook-com-d088b986-291d-42b8-9564-9c414e2aa040\" target=\"_blank\">Outlook.com</a>, <a href=\"https://help.yahoo.com/kb/SLN4075.html\" target=\"_blank\">Yahoo</a>.",
"enabled": "Enable inbox scanning", "enabled": "Enable inbox scanning",
"hostname": "IMAP hostname", "hostname": "IMAP hostname",
"port": "IMAP port (143 or 993)", "port": "IMAP port (143 or 993)",
@ -371,8 +371,8 @@
"password": "IMAP password", "password": "IMAP password",
"tag": "Tag added to imported documents", "tag": "Tag added to imported documents",
"test": "Test the parameters", "test": "Test the parameters",
"last_sync": "Last synchronization: {{ data.date | date }}, {{ data.count }} message{{ data.count > 1 ? 's' : '' }} imported", "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 }} message{{ count > 1 ? 's' : '' }})", "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" "test_fail": "An error occurred while connecting to the inbox, please check the parameters"
}, },
"log": { "log": {

View File

@ -73,4 +73,6 @@
<div class="alert col-sm-9" <div class="alert col-sm-9"
ng-class="{ 'alert-success': testResult.count >= 0, 'alert-danger': testResult.count == -1 }" ng-class="{ 'alert-success': testResult.count >= 0, 'alert-danger': testResult.count == -1 }"
ng-show="testResult">{{ testResult.count >= 0 ? 'settings.inbox.test_success' : 'settings.inbox.test_fail' | translate: { count: testResult.count } }}</div> ng-show="testResult"
translate="{{ testResult.count >= 0 ? 'settings.inbox.test_success' : 'settings.inbox.test_fail' }}"
translate-values="{ count: testResult.count }"></div>

View File

@ -1,9 +1,11 @@
// Logo // Logo
.navbar-logo { .navbar-logo {
margin: 3px; margin: 3px;
img { img {
width: 44px; width: 44px;
height: 44px; height: 44px;
border-radius: 50%;
} }
} }