Skip to content

Add dismiss all alerts and delete all messages buttons.#1046

Merged
ArneBab merged 6 commits intohyphanet:nextfrom
ArneBab:fproxy--add-dismiss-all-alerts-buttons
Jun 28, 2025
Merged

Add dismiss all alerts and delete all messages buttons.#1046
ArneBab merged 6 commits intohyphanet:nextfrom
ArneBab:fproxy--add-dismiss-all-alerts-buttons

Conversation

@ArneBab
Copy link
Contributor

@ArneBab ArneBab commented Mar 23, 2025

No description provided.

@ArneBab ArneBab force-pushed the fproxy--add-dismiss-all-alerts-buttons branch from 62ebf44 to 9f77b50 Compare June 22, 2025 19:32
Comment on lines +78 to +86
for (UserAlert alert : ctx.getAlertManager().getAlerts()) {
if (!alert.userCanDismiss()) {
continue;
}
if (alert instanceof NodeToNodeMessageUserAlert) {
continue; // keep all node to node messages
}
ctx.getAlertManager().dismissAlert(alert.hashCode());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Sorry for shaving this yak, feel free to ignore, but if you don’t ignore it, make sure I got it right, negations are confusing. 😄)

Suggested change
for (UserAlert alert : ctx.getAlertManager().getAlerts()) {
if (!alert.userCanDismiss()) {
continue;
}
if (alert instanceof NodeToNodeMessageUserAlert) {
continue; // keep all node to node messages
}
ctx.getAlertManager().dismissAlert(alert.hashCode());
}
Arrays.stream(ctx.getAlertManager().getAlerts())
.filter(UserAlert::userCanDismiss)
.filter(alert -> !(alert instanceof NodeToNodeMessageUserAlert))
.map(Object::hashCode)
.forEach(ctx.getAlertManager()::dismissAlert);

Comment on lines +90 to +101
for (UserAlert alert : ctx.getAlertManager().getAlerts()) {
if (!(alert instanceof NodeToNodeMessageUserAlert)) {
continue;
}
if (alert instanceof AbstractNodeToNodeFileOfferUserAlert) {
continue; // not deleting file offers, because these need a decision
}
if (!alert.userCanDismiss()) {
continue;
}
ctx.getAlertManager().dismissAlert(alert.hashCode());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(More yak shaving.)

Suggested change
for (UserAlert alert : ctx.getAlertManager().getAlerts()) {
if (!(alert instanceof NodeToNodeMessageUserAlert)) {
continue;
}
if (alert instanceof AbstractNodeToNodeFileOfferUserAlert) {
continue; // not deleting file offers, because these need a decision
}
if (!alert.userCanDismiss()) {
continue;
}
ctx.getAlertManager().dismissAlert(alert.hashCode());
}
Arrays.stream(ctx.getAlertManager().getAlerts())
.filter(NodeToNodeMessageUserAlert.class::isInstance)
.filter(alert -> !(alert instanceof AbstractNodeToNodeFileOfferUserAlert))
.filter(UserAlert::userCanDismiss)
.map(Object::hashCode)
.forEach(ctx.getAlertManager()::dismissAlert);

@ArneBab ArneBab merged commit 6fb681e into hyphanet:next Jun 28, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants