这是indexloc提供的服务,不要输入任何密码
Skip to content

feat: allow text of reply or cw quote to be empty #76

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

Merged
merged 1 commit into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions lib/extension/note_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extension NoteExtension on Note {
bool get isRenote =>
renoteId != null &&
text == null &&
replyId == null &&
cw == null &&
files.isEmpty &&
poll == null;
Expand Down
3 changes: 2 additions & 1 deletion lib/extension/notes_create_request_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ extension NotesCreateRequestExtension on NotesCreateRequest {
bool get isRenote =>
renoteId != null &&
(text?.isEmpty ?? true) &&
replyId == null &&
(cw?.isEmpty ?? true) &&
(fileIds?.isEmpty ?? true) &&
poll == null;

bool get canPost =>
((text?.isNotEmpty ?? false) || poll != null) &&
((text?.isNotEmpty ?? false) || poll != null || renoteId != null) &&
(poll == null ||
(poll!.choices.length >= 2 &&
poll!.choices.every((choice) => choice.isNotEmpty)));
Expand Down
2 changes: 1 addition & 1 deletion lib/view/page/post_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class PostPage extends HookConsumerWidget {
reply?.visibility != NoteVisibility.specified;
final canChangeChannel = (renote?.channel?.allowRenoteToExternal ?? true) &&
reply?.channel == null;
final canPost = request.isRenote || request.canPost || attaches.isNotEmpty;
final canPost = request.canPost || attaches.isNotEmpty;
final needsUpload = attaches.any((file) => file is LocalPostFile);
final (buttonText, buttonIcon) = needsUpload
? (t.misskey.upload, Icons.upload)
Expand Down
2 changes: 1 addition & 1 deletion lib/view/widget/cw_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CwButton extends StatelessWidget {
text: [
if (note case Note(:final text?))
t.misskey.cw_.chars(count: text.length),
if (note.renote != null) t.misskey.quote,
if (note.renoteId != null) t.misskey.quote,
if (note.files.isNotEmpty)
t.misskey.cw_.files(count: note.files.length),
if (note.poll != null) t.misskey.poll,
Expand Down
2 changes: 1 addition & 1 deletion lib/view/widget/post_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class PostForm extends HookConsumerWidget {
tooltip: request.isRenote
? t.misskey.renote
: t.misskey.send,
onPressed: request.isRenote || request.canPost
onPressed: request.canPost || attaches.isNotEmpty
? () => _post(ref, focusNode)
: null,
icon: Icon(
Expand Down