Merge branch 'list-method'

This commit is contained in:
Oliver Davies 2018-08-15 21:37:19 +01:00
commit f25ce7f9f1
3 changed files with 26 additions and 0 deletions

View file

@ -55,6 +55,7 @@ _Conditions that a message must satisfy for the filter to be applied:_
- `to` - if the message is to a certain name or email address.
- `subject` - if the message has a certain subject.
- `hasAttachment` - if the message has an attachment.
- `list` - if the message is from a mailing list.
- `excludeChats` - exclude chats from the results (false by default).
### Actions

View file

@ -97,6 +97,20 @@ class Filter
return $this;
}
/**
* Filter a message if it was sent from a mailing list.
*
* @param $value The mailing list address
*
* @return $this
*/
public function list($value)
{
$this->has("list:{$value}");
return $this;
}
/**
* @return $this
*/

View file

@ -134,6 +134,17 @@ class FilterTest extends TestCase
);
}
/**
* @covers ::list
*/
public function testList()
{
$this->assertEquals(
['hasTheWord' => 'list:foobar'],
$this->filter->list('foobar')->toArray()
);
}
/**
* @covers ::excludeChats
*/