Inverted logic, deletion is not allowed by default.

This commit is contained in:
Andreas Svanberg 2025-03-17 10:51:28 +01:00
parent 7d82bb50b2
commit 46f7d50ed7
3 changed files with 7 additions and 8 deletions
view/src/main/java/se/su/dsv/scipro
forum/panels/threaded
reviewer/timeline

@ -89,7 +89,7 @@ public class ForumPostPanel extends Panel {
}
protected boolean allowDeletion() {
return true;
return false;
}
protected void onPostDeleted() {}

@ -61,6 +61,11 @@ public class ViewForumThreadPanel<A> extends GenericPanel<A> {
ListView<ForumPost> listView = this;
item.add(
new ForumPostPanel(POST, item.getModel()) {
@Override
protected boolean allowDeletion() {
return true;
}
@Override
protected void onPostDeleted() {
// Refresh the list of posts

@ -22,13 +22,7 @@ interface Event {
@Override
public Component component(String id, IModel<Event> model) {
return new ForumPostPanel(id, model.map(Message.class::cast).map(m -> m.forumPost)) {
@Override
protected boolean allowDeletion() {
// Do not allow deleting forum posts in the timeline
return false;
}
};
return new ForumPostPanel(id, model.map(Message.class::cast).map(m -> m.forumPost));
}
@Override