@@ -50,13 +50,13 @@ public class ListMember {
|
||||
}
|
||||
|
||||
public String addNewModerator(String userEmail) {
|
||||
if (!isAllowedToEditMods()) return t("You are not allowed to nominate new mods for {}",list.email());
|
||||
if (!isAllowedToEditMods()) return t("You are not allowed to nominate new mods for {}!",list.email());
|
||||
User moderator = null;
|
||||
try {
|
||||
moderator = User.load(userEmail);
|
||||
} catch (SQLException e) {
|
||||
LOG.warn("Failed to load user for {}",userEmail,e);
|
||||
return t("Failed to load user for {}",userEmail);
|
||||
LOG.warn("Failed to load user for {}!",userEmail,e);
|
||||
return t("Failed to load user for {}!",userEmail);
|
||||
}
|
||||
if (moderator == null) return t("No such user: {}",userEmail);
|
||||
|
||||
@@ -64,8 +64,8 @@ public class ListMember {
|
||||
try {
|
||||
member = ListMember.load(list,moderator);
|
||||
} catch (SQLException e) {
|
||||
LOG.warn("Failed to load list member for {}/{}",moderator.email(),list.email(),e);
|
||||
return t("Failed to load list member for {}/{}",moderator.email(),list.email());
|
||||
LOG.warn("Failed to load list member for {}/{}!",moderator.email(),list.email(),e);
|
||||
return t("Failed to load list member for {}/{}!",moderator.email(),list.email());
|
||||
}
|
||||
try {
|
||||
if (member == null) {
|
||||
@@ -146,13 +146,13 @@ public class ListMember {
|
||||
}
|
||||
|
||||
public String dropMember(String userEmail) {
|
||||
if (!isModerator()) return t("You are not allowed to remove members of {}",list.email());
|
||||
if (!isModerator()) return t("You are not allowed to remove members of {}!",list.email());
|
||||
User user = null;
|
||||
try {
|
||||
user = User.load(userEmail);
|
||||
} catch (SQLException e) {
|
||||
LOG.warn("Failed to load user for {}",userEmail,e);
|
||||
return t("Failed to load user for {}",userEmail);
|
||||
LOG.warn("Failed to load user for {}!",userEmail,e);
|
||||
return t("Failed to load user for {}!",userEmail);
|
||||
}
|
||||
if (user == null) return t("No such user: {}",userEmail);
|
||||
|
||||
@@ -160,30 +160,30 @@ public class ListMember {
|
||||
try {
|
||||
member = ListMember.load(list,user);
|
||||
} catch (SQLException e) {
|
||||
LOG.warn("Failed to load list member for {}/{}",user.email(),list.email(),e);
|
||||
return t("Failed to load list member for {}/{}",user.email(),list.email());
|
||||
LOG.warn("Failed to load list member for {}/{}!",user.email(),list.email(),e);
|
||||
return t("Failed to load list member for {}/{}!",user.email(),list.email());
|
||||
}
|
||||
|
||||
if (member == null) return t("{} is no member of {}",user.email(),list.email());
|
||||
if (member.isOwner()) return t("You are not allowed to remvoe the list owner!");
|
||||
if (member == null) return t("{} is no member of {}!",user.email(),list.email());
|
||||
if (member.isOwner()) return t("You are not allowed to remove the list owner!");
|
||||
|
||||
try {
|
||||
member.unsubscribe();
|
||||
} catch (SQLException e) {
|
||||
LOG.warn("Failed to un-subscribe {} from {}",user.email(),list.email(),e);
|
||||
return t("Failed to un-subscribe {} from {}",user.email(),list.email());
|
||||
LOG.warn("Failed to un-subscribe {} from {}!",user.email(),list.email(),e);
|
||||
return t("Failed to un-subscribe {} from {}!",user.email(),list.email());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String dropModerator(String userEmail) {
|
||||
if (!isAllowedToEditMods()) return t("You are not allowed to edit mods of {}",list.email());
|
||||
if (!isAllowedToEditMods()) return t("You are not allowed to edit mods of {}!",list.email());
|
||||
User moderator = null;
|
||||
try {
|
||||
moderator = User.load(userEmail);
|
||||
} catch (SQLException e) {
|
||||
LOG.warn("Failed to load user for {}",userEmail,e);
|
||||
return t("Failed to load user for {}",userEmail);
|
||||
LOG.warn("Failed to load user for {}!",userEmail,e);
|
||||
return t("Failed to load user for {}!",userEmail);
|
||||
}
|
||||
if (moderator == null) return t("No such user: {}",userEmail);
|
||||
|
||||
@@ -191,8 +191,8 @@ public class ListMember {
|
||||
try {
|
||||
member = ListMember.load(list,moderator);
|
||||
} catch (SQLException e) {
|
||||
LOG.warn("Failed to load list member for {}/{}",moderator.email(),list.email(),e);
|
||||
return t("Failed to load list member for {}/{}",moderator.email(),list.email());
|
||||
LOG.warn("Failed to load list member for {}/{}!",moderator.email(),list.email(),e);
|
||||
return t("Failed to load list member for {}/{}!",moderator.email(),list.email());
|
||||
}
|
||||
try {
|
||||
if (member == null) {
|
||||
@@ -201,8 +201,8 @@ public class ListMember {
|
||||
member.setState(Util.unset(member.state,STATE_MODERATOR));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
LOG.warn("Failed to make {} a subscriber of {}",moderator.email(),list.email(),e);
|
||||
return t("Failed to make {} a subscriber of {}",moderator.email(),list.email());
|
||||
LOG.warn("Failed to make {} a subscriber of {}!",moderator.email(),list.email(),e);
|
||||
return t("Failed to make {} a subscriber of {}!",moderator.email(),list.email());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -392,10 +392,10 @@ public class ListMember {
|
||||
*/
|
||||
public String stateText() {
|
||||
var words = new ArrayList<String>();
|
||||
if (isAwaiting()) words.add("awaiting confirmation");
|
||||
if (isModerator()) words.add("moderator");
|
||||
if (isOwner()) words.add("owner");
|
||||
if (isSubscriber()) words.add("subscriber");
|
||||
if (isAwaiting()) words.add(t("awaiting confirmation"));
|
||||
if (isModerator()) words.add(t("moderator"));
|
||||
if (isOwner()) words.add(t("owner"));
|
||||
if (isSubscriber()) words.add(t("subscriber"));
|
||||
return String.join(", ",words);
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ public class MailingList implements MessageHandler, ProblemListener {
|
||||
var member = ListMember.load(this,user);
|
||||
return member.hasState(ListMember.STATE_OWNER|ListMember.STATE_SUBSCRIBER); // owners may subscribe their own mailing lists
|
||||
} catch (SQLException e) {
|
||||
LOG.warn("Was not able to load ListMember: ",e);
|
||||
LOG.warn("Was not able to load ListMember:",e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -303,7 +303,7 @@ public class MailingList implements MessageHandler, ProblemListener {
|
||||
ml.lastError = rs.getString(LAST_ERROR);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
LOG.debug("Failed to load MailingList: ",e);
|
||||
LOG.debug("Failed to load MailingList:",e);
|
||||
}
|
||||
return ml;
|
||||
}
|
||||
@@ -325,7 +325,7 @@ public class MailingList implements MessageHandler, ProblemListener {
|
||||
.compile().exec();
|
||||
while (rs.next()) list.add(MailingList.from(rs));
|
||||
} catch (SQLException e) {
|
||||
LOG.debug("Failed to load MailingLists: ",e);
|
||||
LOG.debug("Failed to load MailingLists:",e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -671,11 +671,11 @@ public class MailingList implements MessageHandler, ProblemListener {
|
||||
try {
|
||||
var config = Configuration.instance();
|
||||
var url = new StringBuilder(config.baseUrl()).append("/web/confirm?token=").append(member.token()).toString();
|
||||
var subject = t("[{}] Please confirm your list subscription",name());
|
||||
var subject = t("[{}] Please confirm your list subscription!",name());
|
||||
var text = template.add(URL,url).add(LIST_NAME,name()).render();
|
||||
smtp.send(email(),name(),user.email(),subject,text);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new MessagingException(t("Failed to send email to {}",user.email()),e);
|
||||
throw new MessagingException(t("Failed to send email to {}!",user.email()),e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -711,7 +711,7 @@ public class MailingList implements MessageHandler, ProblemListener {
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
public void test(User user) throws MessagingException, UnsupportedEncodingException {
|
||||
var subject = t("[{}]: test mail",name());
|
||||
var subject = t("[{}] test mail",name());
|
||||
var text = "If you received this mail, the SMTP settings of your mailing list are correct.";
|
||||
smtp.login().send(email(),name(),user.email(),subject,text);
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ public class User {
|
||||
* @return
|
||||
*/
|
||||
public Map<String,String> safeMap(){
|
||||
return Map.of(NAME,name,EMAIL,email,PERMISSIONS,permissionList(),PASSWORD,hashedPassword() == null ? "no" : "yes");
|
||||
return Map.of(NAME,name,EMAIL,email,PERMISSIONS,permissionList(),PASSWORD,t(hashedPassword() == null ? "no" : "yes"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user