Ah yea that makes sense, because post() will create a mongo document 
representing the task and all its parameters, so the parameters have to be 
something simple like strings/numbers/lists/etc and not model objects.   (The 
c.user and c.project and c.app models are automatically handled). 

So I would recommend calling send_usermentions_notification with an artifact 
identifier like `.index_id()` instead of the full artifact object: 
`send_usermentions_notification.post(ticket.index_id(), ...`

And then load the Artifact instance in the function, something like this I 
think would work:
```
def send_usermentions_notification(artifact_id, ...):
    artifact = ArtifactReference.query.get(_id=artifact_id).artifact
```


---

** [tickets:#8323] gsoc19 - Trigger notification task per each artifact 
creation/modification and add tests**

**Status:** open
**Milestone:** unreleased
**Labels:** gsoc19 
**Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga
**Last Updated:** Wed Aug 14, 2019 04:19 PM UTC
**Owner:** Shalitha Suranga


Add a test for the send_usermentions_notification task. Also.. 
`send_usermentions_notification` task is only called in a few places so far, 
but would be good to do in all the places where a new artifact is 
created/modified(content) (new wiki page, new ticket, new blog post, new merge 
request). Maybe a new ticket for all that together.


---

Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed 
to https://forge-allura.apache.org/p/allura/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://forge-allura.apache.org/p/allura/admin/tickets/options.  Or, if this is 
a mailing list, you can unsubscribe from the mailing list.

Reply via email to