mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-03 08:15:38 +00:00
fix: hide forward in filter rules when the server allows no redirects #1208
This commit is contained in:
@@ -224,6 +224,9 @@ export function FilterRuleModal({
|
||||
const otherForwards = forwardsBefore + (ruleStops({ actions, stopProcessing }) ? 0 : forwardsAfter);
|
||||
const forwardLimit = typeof maxRedirects === "number" && maxRedirects > 0 ? maxRedirects : null;
|
||||
const forwardOverLimit = forwardLimit !== null && forwardCount + otherForwards > forwardLimit;
|
||||
// A limit of 0: the server runs no redirect at all, as the out of office
|
||||
// card also takes it. A forward the rule already has stays, to be removed.
|
||||
const forwardUnavailable = maxRedirects === 0;
|
||||
|
||||
// While editing, condition.value is always the raw string typed into the
|
||||
// input (commas not yet split). Convert to array form here on save so a
|
||||
@@ -615,7 +618,7 @@ export function FilterRuleModal({
|
||||
className={selectClass}
|
||||
aria-label={t("actions")}
|
||||
>
|
||||
{ALL_ACTION_TYPES.map((a) => (
|
||||
{ALL_ACTION_TYPES.filter((a) => !(forwardUnavailable && a === "forward" && action.type !== "forward")).map((a) => (
|
||||
<option
|
||||
key={a}
|
||||
value={a}
|
||||
@@ -712,6 +715,11 @@ export function FilterRuleModal({
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{forwardUnavailable && forwardCount > 0 && (
|
||||
<p className="mt-2 text-xs text-amber-600 dark:text-amber-400">
|
||||
{t("forward_unavailable")}
|
||||
</p>
|
||||
)}
|
||||
{forwardOverLimit && (
|
||||
<p className="mt-2 text-xs text-amber-600 dark:text-amber-400">
|
||||
{t("forward_limit", { count: forwardLimit })}
|
||||
|
||||
@@ -301,6 +301,8 @@ export function FilterSettings() {
|
||||
const runOrder = inRunOrder(rules, vacationForward);
|
||||
const tooManyForwards =
|
||||
typeof redirectLimit === "number" && redirectLimit > 0 && worstCaseForwards(runOrder) > redirectLimit;
|
||||
// A limit of 0: the server runs no redirect, so the rules' forwards do nothing.
|
||||
const forwardsIgnored = redirectLimit === 0 && worstCaseForwards(rules) > 0;
|
||||
// The edited rule where it is; a new one goes below Bulwark's own rules.
|
||||
const editedIndex = editingRule ? rules.findIndex((r) => r.id === editingRule.id) : -1;
|
||||
const forwardsOfEdited = forwardsAround(
|
||||
@@ -583,6 +585,12 @@ export function FilterSettings() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!isOpaque && forwardsIgnored && (
|
||||
<p className="text-xs text-amber-600 dark:text-amber-400">
|
||||
{t("forward_unavailable")}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{!isOpaque && tooManyForwards && (
|
||||
<p className="text-xs text-amber-600 dark:text-amber-400">
|
||||
{t("forward_limit", { count: redirectLimit })}
|
||||
|
||||
@@ -2258,6 +2258,7 @@
|
||||
"forward_placeholder": "email@example.com",
|
||||
"forward_keep_copy": "Keep a copy",
|
||||
"forward_limit": "Forward limit per message on this server: {count}. Extra forwards are skipped.",
|
||||
"forward_unavailable": "This server does not allow forwarding. Forward actions in filter rules have no effect.",
|
||||
"reject_message": "Rejection message",
|
||||
"reject_placeholder": "Your email has been rejected",
|
||||
"label_name": "Tag name",
|
||||
|
||||
Reference in New Issue
Block a user