[Bug] Request Notifications are incorrectly implemented

  • I have described the bug in complete detail in the Description section.
  • I have specified steps in the Reproduction section.
  • I have included the versions which are affected in the Version(s) section.

Description

PackageRequest-driven notifications are not correct in the current implementation.

In addition, we are missing handling of creating a PackageRequest during an orphan action with no existing requests.

What's going wrong:

  • Way too much.
  • Notification logic is too scattered and incorrect.

Expectation:

  • If a PackageRequest does not exist for the current action (disown = orphan, deletion, merge), create an auto-generated PackageRequest and send out a RequestOpenNotification about it.
  • If a PackageRequest already exists, it is closed and we send out a RequestCloseNotification about it.
  • For all other requests of the same request type which we are not satisfying, reject them and send out RequestCloseNotifications about them.

We should try to centralize this logic into a module made specifically for package requests. Currently, our logic is scattered around aurweb.routers.packages and it's not very clean.

Additionally, we may want to take influence from PHP in this regard; PHP passes the via argument to request actions, which defines the relevent request without extraneous queries.

Reproduction

Delete a package. An incorrect amount of emails are sent out. Testers can rely on the util/sendmail testing sendmail executable to populate ./test-emails via tests.

Version(s)

27f8603d

Edited by Kevin Morris