blob: 5f1c36d40de34d256f8509516435ca9727d9c2ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#include "apactivity.h"
#include "apactor.h"
#include <QDebug>
APActivity::APActivity() {}
APActivity::APActivity(APActivityFields fields) {
for (QString actor_url : fields.to_actors)
to_actors.push_back(APActor(actor_url));
for (QString actor_url : fields.cc_actors)
cc_actors.push_back(APActor(actor_url));
by_actor = fields.by_actor;
object_url = fields.object_url;
published = QDateTime::fromString(fields.published, Qt::ISODate);
visibility = fields.visibility;
type = fields.type;
object = fields.object;
}
APActivity::~APActivity() {
delete object;
}
QString APActivity::get_html_render(HtmlRenderDetails render_info) {
QString html(get_html_template("apactivity"));
switch (type) {
case APActivityType::CREATE:
html.replace("{{type}}", "Create"); break;
case APActivityType::ANNOUNCE:
html.replace("{{type}}", "Announce"); break;
default:
html.replace("{{type}}", "<i>Unknown</i>"); break;
}
html.replace("{{by}}", by_actor.get_html_render(render_info));
html.replace("{{object}}", object->get_html_render(render_info));
if (published.isValid())
html.replace("{{published}}", render_info.locale->toString(published.toLocalTime()));
return html;
}
|