Merge branch 'main' into lang_de
This commit is contained in:
@@ -169,8 +169,6 @@ public class Database {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected Request clone() {
|
||||
Request clone = new Request(new StringBuilder(sql));
|
||||
|
||||
@@ -187,7 +187,7 @@ public class MailingList implements MessageHandler, ProblemListener {
|
||||
}
|
||||
|
||||
private void forward(Message message, Stream<ListMember> members) throws MessagingException {
|
||||
if (hasState(STATE_PUBLIC_ARCHIVE)) storeMessage(message);
|
||||
if (hasPublicArchive()) storeMessage(message);
|
||||
String newSender = !hasState(STATE_FORWARD_FROM) ? email() : null;
|
||||
var receivers = members
|
||||
.map(ListMember::user)
|
||||
@@ -238,6 +238,10 @@ public class MailingList implements MessageHandler, ProblemListener {
|
||||
return ml;
|
||||
}
|
||||
|
||||
public boolean hasPublicArchive() {
|
||||
return hasState(STATE_PUBLIC_ARCHIVE);
|
||||
}
|
||||
|
||||
public boolean hasState(int test){
|
||||
return (state & test) > 0;
|
||||
}
|
||||
@@ -327,6 +331,7 @@ public class MailingList implements MessageHandler, ProblemListener {
|
||||
}
|
||||
|
||||
public boolean mayBeAlteredBy(User user) {
|
||||
if (user == null) return false;
|
||||
if (user.hashPermission(PERMISSION_ADMIN)) return true;
|
||||
try {
|
||||
if (ListMember.load(this,user).isModerator()) return true;
|
||||
@@ -602,9 +607,9 @@ public class MailingList implements MessageHandler, ProblemListener {
|
||||
if (hasState(STATE_FORWARD_ATTACHED)) map.put(t("forward_attached"),HIDDEN);
|
||||
if (hasState(STATE_HIDE_RECEIVERS)) map.put(t("hide_receivers"),HIDDEN);
|
||||
if (hasState(STATE_REPLY_TO_LIST)) map.put(t("reply_to_list"),HIDDEN);
|
||||
if (hasState(STATE_OPEN_FOR_GUESTS)) map.put(t("open_for_guests"),HIDDEN);
|
||||
if (hasState(STATE_OPEN_FOR_SUBSCRIBERS)) map.put(t("open_for_subscribers"),HIDDEN);
|
||||
if (hasState(STATE_PUBLIC_ARCHIVE)) map.put(t("archive"),VISIBLE);
|
||||
if (isOpenForGuests()) map.put(t("open_for_guests"),HIDDEN);
|
||||
if (isOpenForSubscribers()) map.put(t("open_for_subscribers"),HIDDEN);
|
||||
if (hasPublicArchive()) map.put(t("archive"),VISIBLE);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class Post {
|
||||
return new File(filename);
|
||||
}
|
||||
|
||||
public static ArrayList<Post> find(MailingList list, String month, List<String> allowedSenders) throws SQLException {
|
||||
public static ArrayList<Post> find(MailingList list, String month, List<String> allowedSenders) throws SQLException {
|
||||
var query = Database.open()
|
||||
.select(TABLE_NAME,"*","strftime('%Y-%m',date/1000,'unixepoch') as month")
|
||||
.where(LIST,list.email())
|
||||
@@ -140,6 +140,10 @@ public class Post {
|
||||
return id;
|
||||
}
|
||||
|
||||
public MailingList list() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Post load(String id) throws SQLException {
|
||||
var rs = Database.open().select(TABLE_NAME).where(ID,id).compile().exec();
|
||||
try {
|
||||
@@ -160,6 +164,11 @@ public class Post {
|
||||
FILE,filename);
|
||||
}
|
||||
|
||||
public void remove() throws SQLException {
|
||||
Database.open().deleteFrom(TABLE_NAME).where(ID,id).compile().run();
|
||||
file().delete();
|
||||
}
|
||||
|
||||
public Map<String,Object> safeMap() {
|
||||
return Map.of(ID,id,
|
||||
LIST,list.name(),
|
||||
@@ -188,5 +197,4 @@ public class Post {
|
||||
public long timestamp(){
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user