Projet

Général

Profil

Development #22732

notifications : possibilité de non expiration

Ajouté par Frédéric Péters il y a environ 6 ans. Mis à jour il y a plus de 5 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
22 mars 2018
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:

Description

Il est souhaité (#21614) de pouvoir avoir des notifications qui n'expirent pas (de manière heureuse ma spec de référence contient : "If 0, the notification never expires.")

(encore à discuter)


Fichiers

0003-tests-use-freezegun-in-test_notification-22732.patch (3,85 ko) 0003-tests-use-freezegun-in-test_notification-22732.patch Benjamin Dauvergne, 24 mars 2018 02:20
0004-notifications-allow-notifications-without-an-end_tim.patch (5,59 ko) 0004-notifications-allow-notifications-without-an-end_tim.patch Benjamin Dauvergne, 24 mars 2018 02:20
0002-tox.ini-use-pytest-freezegun-22732.patch (514 octets) 0002-tox.ini-use-pytest-freezegun-22732.patch Benjamin Dauvergne, 24 mars 2018 02:20
0001-tests-create-global-fixtures-john.doe-and-jane.doe-2.patch (11,3 ko) 0001-tests-create-global-fixtures-john.doe-and-jane.doe-2.patch Benjamin Dauvergne, 24 mars 2018 02:20
0005-lingo-fix-untested-path-in-notify_new_remote_invoice.patch (1,69 ko) 0005-lingo-fix-untested-path-in-notify_new_remote_invoice.patch Benjamin Dauvergne, 24 mars 2018 02:20
0003-tests-use-freezegun-in-test_notification-22732.patch (3,85 ko) 0003-tests-use-freezegun-in-test_notification-22732.patch Benjamin Dauvergne, 24 mars 2018 02:29
0004-notifications-allow-notifications-without-an-end_tim.patch (6,78 ko) 0004-notifications-allow-notifications-without-an-end_tim.patch Benjamin Dauvergne, 24 mars 2018 02:29
0002-tox.ini-use-pytest-freezegun-22732.patch (514 octets) 0002-tox.ini-use-pytest-freezegun-22732.patch Benjamin Dauvergne, 24 mars 2018 02:29
0001-tests-create-global-fixtures-john.doe-and-jane.doe-2.patch (11,3 ko) 0001-tests-create-global-fixtures-john.doe-and-jane.doe-2.patch Benjamin Dauvergne, 24 mars 2018 02:29
0005-lingo-fix-untested-path-in-notify_new_remote_invoice.patch (1,69 ko) 0005-lingo-fix-untested-path-in-notify_new_remote_invoice.patch Benjamin Dauvergne, 24 mars 2018 02:29

Révisions associées

Révision 4bb38280 (diff)
Ajouté par Benjamin Dauvergne il y a presque 6 ans

tests: create global fixtures john.doe and jane.doe (#22732)

Révision 1e892549 (diff)
Ajouté par Benjamin Dauvergne il y a presque 6 ans

tox.ini: use pytest-freezegun (#22732)

Révision a16ee38a (diff)
Ajouté par Benjamin Dauvergne il y a presque 6 ans

tests: use freezegun in test_notification (#22732)

Révision dab07696 (diff)
Ajouté par Benjamin Dauvergne il y a presque 6 ans

notifications: allow notifications without an end_timestamp (#22732)

Those notifications will disappear only with an action of the user.

Révision 7ff1299e (diff)
Ajouté par Benjamin Dauvergne il y a presque 6 ans

lingo: fix untested path in notify_new_remote_invoices (#22732)

Historique

#3

Mis à jour par Benjamin Dauvergne il y a environ 6 ans

Je n'avais pas lu le ticket lié, les derniers patchs font en sorte qu'un ack() sur une notification sans fin fasse aussi un forget() (on pourrait vouloir faire varier cela, par exemple plutôt qu'un forget donner un end_timestamp proche comme 1 jour).

#4

Mis à jour par Frédéric Péters il y a presque 6 ans

Je viens de pousser ça dans wip/22732-notifications-without-expiration-rebase, à relire parce que rebase délicat.

Notamment parce que ça m'a fait relire des patchs passés genre https://dev.entrouvert.org/attachments/24576/0001-lingo-fix-notifications-expiration-for-expired-invoi.patch où je ne comprends toujours pas pourquoi l'ajout d'une facture à ignorer (c'est le cas que le commit corrige) ajoute malgré tout une notification au compte final.

#5

Mis à jour par Frédéric Péters il y a presque 6 ans

  • Statut changé de Nouveau à En cours
#6

Mis à jour par Frédéric Péters il y a presque 6 ans

Et réponse de Serghei à ça, c'est parce que dans le test (non visible), il y a un passage qui modifie les dates,

        for username in FAKE_PENDING_INVOICES['data']:
            for invoice in FAKE_PENDING_INVOICES['data'][username]['invoices']:
                invoice['pay_limit_date'] = new_pay_limit_date

Comme ce passage est supprimé dans ces tests introduisant freezegun, il apparait donc normal que le compte de notification passe de 3 à 2.

#7

Mis à jour par Emmanuel Cazenave il y a presque 6 ans

La property Notification.visible ne tiens pas compte d'en éventuel end_timestamp à None.

Notification.ack peut se re-écrire en :

def ack(self):
        if self.end_timestamp:
            self.acked = True
            self.save(update_fields=['acked'])
        else:
            self.forget()

Et donc j'essaie de résumer le comportement que l'on obtiens ici : une notification sans expiration est visible ad vitam eternam tant qu'elle n'est pas 'ack' ou 'forget' ces deux actions devenant strictement équivalentes pour une notification de ce type.

Je manque de contexte pour comprendre si c'est bien ça que l'on veut mais si c'est bien ça alors très bien.

#8

Mis à jour par Frédéric Péters il y a presque 6 ans

  • Statut changé de En cours à Résolu (à déployer)

Allez, hop, envoyé tout ça.

commit 7ff1299e2f8292d28bbdca922010da4165a16d74
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Sat Mar 24 02:18:47 2018 +0100

    lingo: fix untested path in notify_new_remote_invoices (#22732)

commit dab07696ffc619cf4b3a1cd89b8020c9421c02c2
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Sat Mar 24 01:50:30 2018 +0100

    notifications: allow notifications without an end_timestamp (#22732)

    Those notifications will disappear only with an action of the user.

commit a16ee38a9994c97e04074bffa6464f0125f7520c
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Sat Mar 24 02:09:33 2018 +0100

    tests: use freezegun in test_notification (#22732)

commit 1e892549f9e43aa985ec3fd814c8a305a5582eac
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Sat Mar 24 02:09:52 2018 +0100

    tox.ini: use pytest-freezegun (#22732)

commit 4bb382806baf431a2f97dc76f0fa8be56953a364
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Sat Mar 24 01:48:55 2018 +0100

    tests: create global fixtures john.doe and jane.doe (#22732)
#9

Mis à jour par Frédéric Péters il y a plus de 5 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF