Commit 782cf396 authored by kaniini's avatar kaniini

Merge branch 'feature/visibility' into 'master'

make post being composed inherit visibility from identity

See merge request !13
parents a3cc347c 2e0cba3a
......@@ -735,6 +735,12 @@ void Identity::fromSourceData(QJsonObject doc)
m_bio = doc["note"].toString();
m_locked = doc["locked"].toBool();
// When the user data is ourselves, we get source.privacy
// with the default post privacy setting for the user. all others
// will get empty strings.
QJsonObject source = doc["source"].toObject();
m_visibility = source["privacy"].toString();
QUrl avatar_url = QUrl(doc["avatar"].toString());
fetchAvatar(avatar_url);
......
......@@ -30,6 +30,7 @@ struct Identity
QString m_bio;
QString m_acct;
bool m_locked;
QString m_visibility;
QImage m_avatar;
void fromSourceData(QJsonObject doc);
......
......@@ -86,9 +86,10 @@ static QMap<QString, Post::Visibility> str_to_vis = {
Post::Post(Account *parent)
: m_parent(parent),
m_is_expanded(true),
m_attachments_visible(true),
m_visibility(Post::Visibility::Public)
m_attachments_visible(true)
{
QString vis_str = parent->identity().m_visibility;
m_visibility = str_to_vis[vis_str];
}
Post::Post(Account *parent, QJsonObject obj)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment