|  | Commit message (Collapse) | Author | Age | Lines | 
|---|
| ... |  | 
| | | | | | | | | | | | 
| | | | | | | | | | | 
| | | | | | | | | | | 
| | | | | | | | | | | | 326beebe9b097731a39ecc9868e5e1f2bd762aae | 
| | | | |\ \ \ \ \ \ \ \  
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | | # Conflicts:
#	bot/utils/__init__.py | 
| | | | |\ \ \ \ \ \ \ \ \ |  | 
| | | | | | | | | | | | | | |  | 
| | | | | | | | | | | | | | |  | 
| | | | | |_|_|_|_|/ / / /  
| | | |/| | | | | | | | |  | 
| | | |\ \ \ \ \ \ \ \ \ \  
| | | | |_|_|/ / / / / /  
| | | |/| | | | | | | | |  | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | | The point of format_user is to have a consistent format across the code
base. That should apply to tests too. | 
| | | |\ \ \ \ \ \ \ \ \ \ |  | 
| | | | | | | | | | | | | | |  | 
| | | |_|_|_|_|_|/ / / / /  
| |/| | | | | | | | | |   
| | | | | | | | | | | |   
| | | | | | | | | | | |   
| | | | | | | | | | | | | Mocking the bot commands channel constant no longer worked after
switching to `in_whitelist_check`. | 
| | | |_|/ / / / / / / /  
| |/| | | | | | | | | |  | 
| | |\ \ \ \ \ \ \ \ \ \  
| | | |/ / / / / / / /  
| | |/| | | | | | | | |  | 
| | | | | | | | | | | | 
| | | | | | | | | | | 
| | | | | | | | | | | 
| | | | | | | | | | | | It's clearer to write MAX_CHANNELS - 2 than a literal 48. | 
| | | | | | | | | | | | |  | 
| | | | | | | | | | | | 
| | | | | | | | | | | 
| | | | | | | | | | | 
| | | | | | | | | | | 
| | | | | | | | | | | | The test has to account for not only the name not matching, but also
a lack of available spaces for new channels. | 
| | | | | | | | | | | | |  | 
| | | |\| | | | | | | | |  | 
| | | | | | | | | | | | |  | 
| | | | |\ \ \ \ \ \ \ \  
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | | Add upstream changes & resolve config conflicts introduced by #1041.
In the conflicting parts of the diff, this commit also re-sorts
constants which were added upstream to lexicographical order.
This does **not** re-sort all constants added upstream. | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]> | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | | Suggested by Mark during review. If the download fails, we fallback
on showing an informative message, which will link the attachment
cdn link.
The attachment-handling logic was moved from the `archive` coroutine
into `make_embed`, which now also returns the file, if available.
In the end, this appears to be the smoothest approach.
Co-authored-by: MarkKoz <[email protected]> | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]> | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | 
| | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]> | 
| | | | |\ \ \ \ \ \ \ \ \ |  | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | | There is no handling of file types as explained in the `archive`
docstring. Testing indicates that relaying incidents with e.g. a text
file attachment is simply a noop in the Discord GUI.
If there is at least one attachment, we always only relay the one
at index 0, as it is believed the user-sent messages can only contain
one attachment at maximum.
This also adds an extra test asserting the behaviour when an incident
with an attachment is archived. The existing test for `archive` is
adjusted to assume no attachments.
Joe helped me conceive & test this.
Co-authored-by: Joseph Banks <[email protected]> | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | | This applies the previously defined `make_embed` function.
As the `archive` function is now simpler, I decided to reduce the
amount of whitespace ~ it's a lot more compact now.
Tests are adjusted as appropriate. | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | | See `make_embed` docstring for further information.
The tests are fairly loose and should be easily adjustable in
the future should changes be made. | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | | This is an important piece of information that shall be relayed. | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | | Decision was made to use embeds to archive incidents instead of
webhooking the raw message. As such, we're reverting the branch
to a state from which the adjustments will be easier to make.
Reverted commits:
* a8d179d9b04f54b20c5e870bcfa85c78c42c8dca
* 6fa8caed037b247a7c194f58a4635de7dae21fd2 | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | | Incident author and the moderator who actioned report are now passed
through `make_username` to create the webhook username.
Tests adjusted as appropriate. | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | | The justification is to incorporate the `actioned_by` name into the
username in some way, and so the logical thing to do is to abstract
this process into a helper so that it can easily be adjusted in the
future. For now, I've chosen to separate the names by a pipe.
Discord webhook username cannot exceed 80 characters in length, and
so we cap it at this length by default. This is seen as more of an
edge-case, but it should be accounted for, as we're not joining two
names. The `max_length` param is configurable primarily for testing
purposes, it probably should never be passed explicitly.
This commit also provides two tests for the function. | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | | See: a8b4e394d9da57287cd9497cd9bb0a97fa467e84 | 
| | | | |\ \ \ \ \ \ \ \ \ \  
| | | | | |_|_|_|/ / / / /  
| | | | |/| | | | | | | |   
| | | | | | | | | | | | | | Adds the `sub_clyde` function, which we'll apply to our webhook. | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | | This is already being patched at class-level. | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | | Suggested by Mark during review. This follows the "ask for forgiveness
rather than permission" paradigm, ends up being less code to read, and
may be seen as more logical / safer.
The `ALLOWED_EMOJI` set was renamed to `ALL_SIGNALS` as this now better
communicates the set's purpose.
Tests adjusted as appropriate.
Co-authored-by: MarkKoz <[email protected]> | 
| | | | | | | | | | | | | | |  | 
| | | | | | | | | | | | | | |  | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | 
| | | | | | | | | | | | | | See the docstring. This does not make the ambition to be powerful
enough to be included in `tests.helpers`, and is only intended
for local purposes. | 
| | | | |\ \ \ \ \ \ \ \ \ \ |  | 
| | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | This also breaks the helpers import statement into a vertical list,
as the amount of imports has grown too much. I still believe that
this is a preferred alternative to accessing the helpers via module
namespace, as we use them a lot, and the added visual noise would
be annoying to read - their names are already descriptive enough. | 
| | | | | | | | | | | | | | | |  | 
| | | | | | | | | | | | | | | |  | 
| | | | | | | | | | | | | | | |  | 
| | | | | | | | | | | | | | | |  | 
| | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | This will be useful for others tests as well. | 
| | | | | | | | | | | | | | | |  | 
| | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | For cleanliness, I've decided to make a separate class for each method.
Since most tests will want to have an `Incident` instance ready, they
can inherit the `setUp` from `TestIncidents`, which does not make any
assertions on its own. | 
| | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | Let's make it clear that this is our own mock. We also move the
definition to the top of the module. | 
| | | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | 
| | | | | | | | | | | | | | | No reason to build own MagicMocks as we already have helpers that
more accurately mimic the mocked behaviour. |