fix лишней рассылки админам
This commit is contained in:
@@ -60,8 +60,6 @@ public class CheckAccount extends Pass<Boolean> {
|
||||
if (Global.componentsServer.db.bugReports.getUI().getCurrent() != null)
|
||||
Global.mainModule.getUI().getMainWindow().getCallbackWindow().ShowCurrentBugReport();
|
||||
}
|
||||
if (Global.mainModule.getAccount().isAdmin())
|
||||
Global.mainModule.getPass(PassCode.PublishComponent).setControlsVisible(true);
|
||||
setControlsVisible(false); //если проверка успешна, кнопку больше не показывать.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
|
||||
import _VisualDVM.Repository.EmailMessage;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.Repository.Subscribes.Subscriber;
|
||||
import _VisualDVM.Utils;
|
||||
|
||||
import java.util.Vector;
|
||||
//http://java-online.ru/javax-mail.xhtml
|
||||
@@ -34,11 +36,13 @@ public class Email extends ComponentsRepositoryPass<EmailMessage> {
|
||||
}
|
||||
}
|
||||
}
|
||||
Utils.addDefaultMails(target.targets);
|
||||
String text_ =
|
||||
"Адресаты: " + String.join(", ", targetsNames) + "\n" +
|
||||
target.text;
|
||||
//нужно разделить сообщение на несколько одинаковых, по числу адресатов.
|
||||
for (String recipient : target.targets) {
|
||||
System.out.println(recipient);
|
||||
EmailMessage part = new EmailMessage();
|
||||
part.subject = target.subject;
|
||||
part.text = text_;
|
||||
|
||||
@@ -21,7 +21,6 @@ public class GetComponentsActualVersions extends ComponentsRepositoryPass {
|
||||
protected void ServerAction() throws Exception {
|
||||
Vector<String> versions = new Vector<>();
|
||||
for (Component component : Global.components.Data.values())
|
||||
//if (component.isVisible())
|
||||
versions.add(component.getComponentType().toString());
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.GetComponentsVersions, String.join("\n", versions)));
|
||||
LinkedHashMap<ComponentType, String> response_actual_versions = (LinkedHashMap<ComponentType, String>) response.object;
|
||||
|
||||
@@ -82,7 +82,7 @@ public class ComponentsForm extends DataSetControlForm<Component> {
|
||||
}
|
||||
}
|
||||
);
|
||||
MainModule_.instance.getPass(PassCode.PublishComponent).setControlsVisible(false);
|
||||
Global.mainModule.getPass(PassCode.PublishComponent).setControlsVisible(Global.mainModule.getAccount().isAdmin());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -105,8 +105,6 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
Utils_.bytesToFile(message_in.files.get(aName), f);
|
||||
innerFiles.put(aName, f);
|
||||
}
|
||||
Vector<String> targets_ = new Vector<>(message_in.targets);
|
||||
Utils.addDefaultMails(targets_);
|
||||
//------------------------------
|
||||
Session session = Session.getDefaultInstance(props,
|
||||
new Authenticator() {
|
||||
@@ -117,7 +115,7 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
Constants.MailPassword);
|
||||
}
|
||||
});
|
||||
for (String target : targets_) {
|
||||
for (String target : message_in.targets) {
|
||||
boolean done = false;
|
||||
int attempts = 5;
|
||||
while (!done && (attempts > 0)) {
|
||||
|
||||
@@ -108,6 +108,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
}
|
||||
@Override
|
||||
protected void checkTargets(EmailMessage message_in) {
|
||||
System.out.println("unckeched targets = "+String.join(" ", message_in.targets));
|
||||
Vector<String> checkedTargets = new Vector<>();
|
||||
for (String email : message_in.targets) {
|
||||
if (db.subscribers.containsKey(email)) {
|
||||
@@ -118,6 +119,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
} else checkedTargets.add(email); //если почта не зарегана значит это мейл с регистрацией.
|
||||
}
|
||||
message_in.targets = checkedTargets;
|
||||
System.out.println("checked targets = "+String.join(" ", message_in.targets));
|
||||
}
|
||||
@Override
|
||||
public void afterDeleteAction(DBObject object) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user