mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 06:22:24 +01:00
Add thread id and URL to review API
This commit is contained in:
parent
43e9641feb
commit
9e446e7524
@ -192,6 +192,8 @@ class PackageReview(db.Model):
|
|||||||
return pos, neg, user_vote.is_positive if user_vote else None
|
return pos, neg, user_vote.is_positive if user_vote else None
|
||||||
|
|
||||||
def as_dict(self, include_package=False):
|
def as_dict(self, include_package=False):
|
||||||
|
from app.utils import abs_url_for
|
||||||
|
|
||||||
pos, neg, _user = self.get_totals()
|
pos, neg, _user = self.get_totals()
|
||||||
ret = {
|
ret = {
|
||||||
"is_positive": self.rating > 3,
|
"is_positive": self.rating > 3,
|
||||||
@ -207,6 +209,10 @@ class PackageReview(db.Model):
|
|||||||
},
|
},
|
||||||
"title": self.thread.title,
|
"title": self.thread.title,
|
||||||
"comment": self.thread.first_reply.comment,
|
"comment": self.thread.first_reply.comment,
|
||||||
|
"thread": {
|
||||||
|
"id": self.thread.id,
|
||||||
|
"url": abs_url_for("threads.view", id=self.thread.id),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
if include_package:
|
if include_package:
|
||||||
ret["package"] = self.package.as_key_dict()
|
ret["package"] = self.package.as_key_dict()
|
||||||
|
Loading…
Reference in New Issue
Block a user