Page MenuHomePhabricator

Define available Herald rule repetition options in terms of "isSingleEventAdapter()"
ClosedPublic

Authored by epriestley on Jan 25 2018, 3:42 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 21, 11:07 PM
Unknown Object (File)
Thu, Dec 12, 8:34 AM
Unknown Object (File)
Tue, Dec 10, 12:43 PM
Unknown Object (File)
Nov 19 2024, 12:53 PM
Unknown Object (File)
Nov 15 2024, 12:51 PM
Unknown Object (File)
Nov 14 2024, 4:05 AM
Unknown Object (File)
Nov 11 2024, 1:37 AM
Unknown Object (File)
Nov 6 2024, 8:04 PM
Subscribers
None

Details

Summary

Depends on D18924. Ref T13048. Each adapter defines which repetition options ("every time", "only the first time") users may select for rules.

Currently, this is all explicit and hard-coded. However, every adapter really just implements this rule (except for some bugs, see below):

You can pick "only the first time" if this adapter fires more than once on the same object.

Since we already have a isSingleEventAdapter() method which lets us tell if an adapter fires more than once, just write this rule in the base class and delete all the copy/pasting.

This also fixes two bugs because of the copy/pasting: Pholio Mocks and Phriction Documents did not allow you to write "only the first time" rules. There's no reason for this, they just didn't copy/paste enough methods when they were implemented.

This will make a future diff (which introduces an "if the rule did not match last time" policy) cleaner.

Test Plan
  • Checked several different types of rules, saw appropriate options in the dropdown (pre-commit: no options; tasks: first or every).
  • Checked mocks and wiki docs, saw that you can now write "only the first time" rules.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable