Skip to content

Commit

Permalink
fix: hide extra mentions warning if not reply (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon authored Oct 30, 2024
1 parent 9573968 commit 040837c
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions lib/view/widget/post_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,15 @@ class PostForm extends HookConsumerWidget {
[mentions],
);
final extraMentions = useMemoized(
() => mentions.where(
(mention) =>
reply?.user.acct != mention.acct &&
replyMentions.every(
(replyMention) => replyMention.acct != mention.acct,
),
),
() => reply != null
? mentions.where(
(mention) =>
reply.user.acct != mention.acct &&
replyMentions.every(
(replyMention) => replyMention.acct != mention.acct,
),
)
: <MfmMention>[],
[mentions, reply, replyMentions],
);
final visibleUsers = useState(<UserDetailed>[]);
Expand All @@ -236,6 +238,7 @@ class PostForm extends HookConsumerWidget {
user.username == mention.username && user.host == mention.host,
),
),
[mentions, visibleUsers],
);
final canChangeLocalOnly = noteId == null &&
request.channelId == null &&
Expand Down Expand Up @@ -746,7 +749,7 @@ class PostForm extends HookConsumerWidget {
),
if (request.visibility == NoteVisibility.specified) ...[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Wrap(
spacing: 4.0,
runSpacing: 4.0,
Expand Down Expand Up @@ -795,8 +798,10 @@ class PostForm extends HookConsumerWidget {
],
),
),
if (notSpecifiedMentions.isNotEmpty)
const SizedBox(height: 8.0),
if (notSpecifiedMentions.isNotEmpty) ...[
Card(
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
Expand Down Expand Up @@ -840,9 +845,12 @@ class PostForm extends HookConsumerWidget {
),
),
),
const SizedBox(height: 8.0),
],
],
if (hasMentionToRemote && (request.localOnly ?? false))
if (hasMentionToRemote && (request.localOnly ?? false)) ...[
Card(
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
Expand All @@ -868,8 +876,11 @@ class PostForm extends HookConsumerWidget {
),
),
),
if (extraMentions.isNotEmpty)
const SizedBox(height: 8.0),
],
if (extraMentions.isNotEmpty) ...[
Card(
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
Expand All @@ -894,6 +905,8 @@ class PostForm extends HookConsumerWidget {
),
),
),
const SizedBox(height: 8.0),
],
if (useCw.value) ...[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
Expand Down

0 comments on commit 040837c

Please sign in to comment.