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)
Tue, Nov 19, 12:53 PM
Unknown Object (File)
Fri, Nov 15, 12:51 PM
Unknown Object (File)
Thu, Nov 14, 4:05 AM
Unknown Object (File)
Mon, Nov 11, 1:37 AM
Unknown Object (File)
Wed, Nov 6, 8:04 PM
Unknown Object (File)
Sun, Nov 3, 12:26 PM
Unknown Object (File)
Oct 21 2024, 12:07 PM
Unknown Object (File)
Oct 19 2024, 9:53 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