fix бага с отключенной рассылкой
This commit is contained in:
3
.idea/workspace.xml
generated
3
.idea/workspace.xml
generated
@@ -8,7 +8,8 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPlanner.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Repository/RepositoryServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/RepositoryServer.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Repository/Server/ComponentsServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Server/ComponentsServer.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|||||||
@@ -80,7 +80,10 @@ public abstract class RepositoryServer<D extends Database> {
|
|||||||
Log.close();
|
Log.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
protected void checkTargets(EmailMessage message_in) {
|
||||||
|
}
|
||||||
public void Email(EmailMessage message_in, File... directAttachements) throws Exception {
|
public void Email(EmailMessage message_in, File... directAttachements) throws Exception {
|
||||||
|
checkTargets(message_in);
|
||||||
Thread thread = new Thread(() -> {
|
Thread thread = new Thread(() -> {
|
||||||
System.out.println("EMAIL THREAD STARTED");
|
System.out.println("EMAIL THREAD STARTED");
|
||||||
try {
|
try {
|
||||||
@@ -115,8 +118,6 @@ public abstract class RepositoryServer<D extends Database> {
|
|||||||
});
|
});
|
||||||
for (String target : targets_) {
|
for (String target : targets_) {
|
||||||
System.out.println("target=" + target);
|
System.out.println("target=" + target);
|
||||||
if (needsEmail(target)) {
|
|
||||||
System.out.println("needs email");
|
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
int attempts = 5;
|
int attempts = 5;
|
||||||
while (!done && (attempts > 0)) {
|
while (!done && (attempts > 0)) {
|
||||||
@@ -157,7 +158,6 @@ public abstract class RepositoryServer<D extends Database> {
|
|||||||
attempts--;
|
attempts--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else System.out.println("does not need email");
|
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.out.println("Исключение во время выполнения рассылки.");
|
System.out.println("Исключение во время выполнения рассылки.");
|
||||||
@@ -167,9 +167,6 @@ public abstract class RepositoryServer<D extends Database> {
|
|||||||
});
|
});
|
||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
public boolean needsEmail(String email) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public boolean canDelete(DBObject object) throws Exception {
|
public boolean canDelete(DBObject object) throws Exception {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,19 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
|||||||
return 7995;
|
return 7995;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
protected void checkTargets(EmailMessage message_in) {
|
||||||
|
Vector<String> checkedTargets = new Vector<>();
|
||||||
|
for (String email: message_in.targets){
|
||||||
|
if (db.subscribers.containsKey(email)){
|
||||||
|
Subscriber subscriber = db.subscribers.get(email);
|
||||||
|
if (subscriber.mailOn>0){
|
||||||
|
checkedTargets.add(email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
message_in.targets = checkedTargets;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public void afterDeleteAction(DBObject object) throws Exception {
|
public void afterDeleteAction(DBObject object) throws Exception {
|
||||||
if (object instanceof BugReport) {
|
if (object instanceof BugReport) {
|
||||||
BugReport bugReport = (BugReport) object;
|
BugReport bugReport = (BugReport) object;
|
||||||
|
|||||||
Reference in New Issue
Block a user