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, May 4, 6:23 PM
Unknown Object (File)
Wed, Apr 24, 10:43 PM
Unknown Object (File)
Fri, Apr 19, 7:09 PM
Unknown Object (File)
Thu, Apr 11, 7:38 AM
Unknown Object (File)
Apr 3 2024, 3:57 PM
Unknown Object (File)
Apr 2 2024, 4:51 PM
Unknown Object (File)
Mar 5 2024, 12:00 PM
Unknown Object (File)
Feb 11 2024, 9:18 AM
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