TF-3379 Show replyAll button when sender not me
This commit is contained in:
@@ -17,6 +17,7 @@ import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/capability/capability_identifier.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/user_name.dart';
|
||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/calendar/calendar_event.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/calendar/properties/attendee/calendar_attendee.dart';
|
||||
@@ -174,6 +175,8 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
|
||||
Session? get session => mailboxDashBoardController.sessionCurrent;
|
||||
|
||||
UserName? get userName => session?.username;
|
||||
|
||||
SingleEmailController(
|
||||
this._getEmailContentInteractor,
|
||||
this._markAsEmailReadInteractor,
|
||||
|
||||
@@ -132,7 +132,7 @@ class _EmailReceiverWidgetState extends State<EmailReceiverWidget> {
|
||||
]
|
||||
),
|
||||
),
|
||||
if (widget.emailSelected.numberOfAllEmailAddress() > 1)
|
||||
if (widget.emailSelected.countRecipients > 1)
|
||||
TMailButtonWidget.fromIcon(
|
||||
icon: _imagePaths.icChevronDown,
|
||||
backgroundColor: Colors.transparent,
|
||||
@@ -217,7 +217,7 @@ class _EmailReceiverWidgetState extends State<EmailReceiverWidget> {
|
||||
]
|
||||
),
|
||||
),
|
||||
if (widget.emailSelected.numberOfAllEmailAddress() > 1)
|
||||
if (widget.emailSelected.countRecipients > 1)
|
||||
TMailButtonWidget.fromIcon(
|
||||
icon: _imagePaths.icChevronDown,
|
||||
backgroundColor: Colors.transparent,
|
||||
|
||||
@@ -48,8 +48,11 @@ class EmailViewBottomBarWidget extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
Obx(() {
|
||||
if (_singleEmailController.currentEmailLoaded.value != null
|
||||
&& presentationEmail.numberOfAllEmailAddress() > 1) {
|
||||
final emailLoader = _singleEmailController.currentEmailLoaded.value;
|
||||
final countMailAddress = presentationEmail.getCountMailAddressWithoutMe(
|
||||
_singleEmailController.userName?.value ?? '',
|
||||
);
|
||||
if (emailLoader != null && countMailAddress > 1) {
|
||||
return Expanded(
|
||||
child: TMailButtonWidget(
|
||||
key: const Key('reply_all_emails_button'),
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ class InformationSenderAndReceiverBuilder extends StatelessWidget {
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 16, end: 16, top: 16),
|
||||
child: Row(
|
||||
crossAxisAlignment: emailSelected.numberOfAllEmailAddress() > 0
|
||||
crossAxisAlignment: emailSelected.countRecipients > 0
|
||||
? CrossAxisAlignment.start
|
||||
: CrossAxisAlignment.center,
|
||||
children: [
|
||||
@@ -96,7 +96,7 @@ class InformationSenderAndReceiverBuilder extends StatelessWidget {
|
||||
)),
|
||||
ReceivedTimeBuilder(emailSelected: emailSelected),
|
||||
]),
|
||||
if (emailSelected.numberOfAllEmailAddress() > 0)
|
||||
if (emailSelected.countRecipients > 0)
|
||||
EmailReceiverWidget(
|
||||
emailSelected: emailSelected,
|
||||
maxWidth: constraints.maxWidth,
|
||||
|
||||
@@ -76,7 +76,7 @@ class SendingEmailTileWidget extends StatelessWidget {
|
||||
)
|
||||
else
|
||||
SvgPicture.asset(
|
||||
sendingEmail.presentationEmail.numberOfAllEmailAddress() == 1
|
||||
sendingEmail.presentationEmail.countRecipients == 1
|
||||
? sendingEmail.sendingState.getAvatarPersonal(_imagePaths)
|
||||
: sendingEmail.sendingState.getAvatarGroup(_imagePaths),
|
||||
fit: BoxFit.fill,
|
||||
|
||||
@@ -47,6 +47,10 @@ extension SetEmailAddressExtension on Set<EmailAddress>? {
|
||||
? this!.where((emailAddress) => emailAddress.email != emailAddressNotExist).toList()
|
||||
: List.empty();
|
||||
}
|
||||
|
||||
Set<EmailAddress> withoutMe(String userName) {
|
||||
return filterEmailAddress(userName).toSet();
|
||||
}
|
||||
}
|
||||
|
||||
extension ListEmailAddressExtension on List<EmailAddress> {
|
||||
|
||||
@@ -29,7 +29,16 @@ extension PresentationEmailExtension on PresentationEmail {
|
||||
}
|
||||
}
|
||||
|
||||
int numberOfAllEmailAddress() => to.numberEmailAddress() + cc.numberEmailAddress() + bcc.numberEmailAddress();
|
||||
int get countRecipients =>
|
||||
to.numberEmailAddress() +
|
||||
cc.numberEmailAddress() +
|
||||
bcc.numberEmailAddress();
|
||||
|
||||
int getCountMailAddressWithoutMe(String userName) =>
|
||||
to.withoutMe(userName).numberEmailAddress() +
|
||||
cc.withoutMe(userName).numberEmailAddress() +
|
||||
bcc.withoutMe(userName).numberEmailAddress() +
|
||||
from.withoutMe(userName).numberEmailAddress();
|
||||
|
||||
String getReceivedAt(String newLocale, {String? pattern}) {
|
||||
final emailTime = receivedAt;
|
||||
|
||||
Reference in New Issue
Block a user