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
F15416150: D18925.id45393.diff
Thu, Mar 20, 9:37 AM
F15412755: D18925.id.diff
Wed, Mar 19, 2:44 PM
F15409142: D18925.diff
Wed, Mar 19, 3:23 AM
F15407730: D18925.diff
Tue, Mar 18, 7:12 PM
F15400333: D18925.diff
Mon, Mar 17, 11:04 AM
F15397862: D18925.id45393.diff
Sun, Mar 16, 10:39 PM
F15393885: D18925.diff
Sat, Mar 15, 11:12 PM
F15385167: D18925.id45393.diff
Fri, Mar 14, 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
Branch
herald2
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 19174
Build 25891: Run Core Tests
Build 25890: arc lint + arc unit