mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-20 09:54:19 +01:00
refactor: impl transitive trust via NoteOptions::TrustMedia
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -255,7 +255,6 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
||||
self.note_context,
|
||||
txn,
|
||||
self.note,
|
||||
self.parent,
|
||||
self.flags,
|
||||
self.jobs,
|
||||
));
|
||||
@@ -303,6 +302,18 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
||||
}
|
||||
|
||||
pub fn show(&mut self, ui: &mut egui::Ui) -> NoteResponse {
|
||||
if !self.flags.contains(NoteOptions::TrustMedia) {
|
||||
let acc = self.note_context.accounts.get_selected_account();
|
||||
if self.note.pubkey() == acc.key.pubkey.bytes()
|
||||
|| matches!(
|
||||
acc.is_following(self.note.pubkey()),
|
||||
notedeck::IsFollowing::Yes
|
||||
)
|
||||
{
|
||||
self.flags = self.flags.union(NoteOptions::TrustMedia);
|
||||
}
|
||||
}
|
||||
|
||||
if self.options().contains(NoteOptions::Textmode) {
|
||||
NoteResponse::new(self.textmode_ui(ui))
|
||||
} else if self.options().contains(NoteOptions::Framed) {
|
||||
@@ -426,14 +437,8 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
||||
});
|
||||
}
|
||||
|
||||
let mut contents = NoteContents::new(
|
||||
self.note_context,
|
||||
txn,
|
||||
self.note,
|
||||
self.parent,
|
||||
self.flags,
|
||||
self.jobs,
|
||||
);
|
||||
let mut contents =
|
||||
NoteContents::new(self.note_context, txn, self.note, self.flags, self.jobs);
|
||||
|
||||
ui.add(&mut contents);
|
||||
|
||||
@@ -526,14 +531,8 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
||||
});
|
||||
}
|
||||
|
||||
let mut contents = NoteContents::new(
|
||||
self.note_context,
|
||||
txn,
|
||||
self.note,
|
||||
self.parent,
|
||||
self.flags,
|
||||
self.jobs,
|
||||
);
|
||||
let mut contents =
|
||||
NoteContents::new(self.note_context, txn, self.note, self.flags, self.jobs);
|
||||
ui.add(&mut contents);
|
||||
|
||||
note_action = contents.action.or(note_action);
|
||||
|
||||
Reference in New Issue
Block a user