Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hide extra mentions warning if not reply #461

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading