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