summary refs log tree commit diff
path: root/src/timeline/TimelineModel.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2024-08-21 00:14:34 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2024-08-21 00:29:11 +0200
commitd1eb35197546a491ce3503c7c2582980e90b6c52 (patch)
treef563e0a6d99e423970d9bfd954f24123bb8608ed /src/timeline/TimelineModel.cpp
parentWarn about room name and topic not being encrypted (diff)
downloadnheko-d1eb35197546a491ce3503c7c2582980e90b6c52.tar.xz
Allow loading image only after explicit interactions
Diffstat (limited to 'src/timeline/TimelineModel.cpp')
-rw-r--r--src/timeline/TimelineModel.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp

index 48b58ee5..eea345b5 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -3387,4 +3387,26 @@ TimelineModel::parentSpace() return parentSummary.get(); } +bool +TimelineModel::showImage() const +{ + auto show = UserSettings::instance()->showImage(); + + switch (show) { + case UserSettings::ShowImage::Always: + return true; + case UserSettings::ShowImage::OnlyPrivate: { + auto accessRules = cache::client() + ->getStateEvent<mtx::events::state::JoinRules>(room_id_.toStdString()) + .value_or(mtx::events::StateEvent<mtx::events::state::JoinRules>{}) + .content; + + return accessRules.join_rule != mtx::events::state::JoinRule::Public; + } + case UserSettings::ShowImage::Never: + default: + return false; + } +} + #include "moc_TimelineModel.cpp"