Skip to content

Commit

Permalink
Merge pull request #5469 from 21pages/ab2
Browse files Browse the repository at this point in the history
filter tags with union, not intersection
  • Loading branch information
rustdesk committed Aug 22, 2023
2 parents 39e3b13 + a48532d commit 9383d4c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
19 changes: 18 additions & 1 deletion flutter/lib/common/widgets/peer_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class _PeerCardState extends State<_PeerCard>
final name =
'${peer.username}${peer.username.isNotEmpty && peer.hostname.isNotEmpty ? '@' : ''}${peer.hostname}';
final PeerTabModel peerTabModel = Provider.of(context);
return Card(
final child = Card(
margin: EdgeInsets.symmetric(horizontal: 2),
child: GestureDetector(
onTap: () {
Expand Down Expand Up @@ -115,6 +115,23 @@ class _PeerCardState extends State<_PeerCard>
],
),
)));
final colors = _frontN(peer.tags, 25).map((e) => str2color2(e)).toList();
return Tooltip(
message: peer.tags.isNotEmpty
? '${translate('Tags')}: ${peer.tags.join(', ')}'
: '',
child: Stack(children: [
child,
if (colors.isNotEmpty)
Positioned(
top: 2,
right: 10,
child: CustomPaint(
painter: TagPainter(radius: 3, colors: colors),
),
)
]),
);
}

Widget _buildDesktop() {
Expand Down
9 changes: 3 additions & 6 deletions flutter/lib/common/widgets/peers_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,12 @@ class AddressBookPeersView extends BasePeersView {
if (selectedTags.isEmpty) {
return true;
}
if (idents.isEmpty) {
return false;
}
for (final tag in selectedTags) {
if (!idents.contains(tag)) {
return false;
if (idents.contains(tag)) {
return true;
}
}
return true;
return false;
}
}

Expand Down

0 comments on commit 9383d4c

Please sign in to comment.