kopia lustrzana https://gitlab.com/mysocialportal/relatica
Fix reshare confusion where isReshare => youReshared
rodzic
fae87a1ece
commit
454a5180d3
|
@ -35,7 +35,7 @@ class _InteractionsBarControlState extends State<InteractionsBarControl> {
|
|||
|
||||
bool get isFavorited => widget.entry.isFavorited;
|
||||
|
||||
bool get isReshared => widget.entry.isReshare;
|
||||
bool get youReshared => widget.entry.youReshared;
|
||||
|
||||
int get reshares => widget.entry.engagementSummary.rebloggedCount;
|
||||
|
||||
|
@ -157,21 +157,21 @@ class _InteractionsBarControlState extends State<InteractionsBarControl> {
|
|||
: Icon(Icons.thumb_up_outlined)),
|
||||
if (isPost)
|
||||
IconButton(
|
||||
onPressed: widget.isMine && !widget.entry.isReshare
|
||||
onPressed: widget.isMine && !widget.entry.youReshared
|
||||
? null
|
||||
: isProcessing
|
||||
? null
|
||||
: () async => isReshared
|
||||
: () async => youReshared
|
||||
? await unResharePost()
|
||||
: await resharePost(),
|
||||
icon:
|
||||
Icon(isReshared ? Icons.repeat_on_outlined : Icons.repeat)),
|
||||
icon: Icon(
|
||||
youReshared ? Icons.repeat_on_outlined : Icons.repeat)),
|
||||
IconButton(
|
||||
onPressed: isProcessing ? null : addComment,
|
||||
icon: Icon(Icons.add_comment)),
|
||||
if (widget.isMine &&
|
||||
!widget.entry
|
||||
.isReshare) //TODO Figure out why reshares show up as mine sometimes but not others
|
||||
.youReshared) //TODO Figure out why reshares show up as mine sometimes but not others
|
||||
IconButton(
|
||||
onPressed:
|
||||
isProcessing ? null : () async => await deleteEntry(),
|
||||
|
|
|
@ -30,7 +30,7 @@ class TimelineEntry {
|
|||
|
||||
final String spoilerText;
|
||||
|
||||
final bool isReshare;
|
||||
final bool youReshared;
|
||||
|
||||
final bool isPublic;
|
||||
|
||||
|
@ -60,7 +60,7 @@ class TimelineEntry {
|
|||
this.creationTimestamp = 0,
|
||||
this.backdatedTimestamp = 0,
|
||||
this.modificationTimestamp = 0,
|
||||
this.isReshare = false,
|
||||
this.youReshared = false,
|
||||
this.isPublic = true,
|
||||
this.body = '',
|
||||
this.title = '',
|
||||
|
@ -86,7 +86,7 @@ class TimelineEntry {
|
|||
backdatedTimestamp = DateTime.now().millisecondsSinceEpoch,
|
||||
modificationTimestamp = DateTime.now().millisecondsSinceEpoch,
|
||||
id = randomId(),
|
||||
isReshare = DateTime.now().second ~/ 2 == 0 ? true : false,
|
||||
youReshared = DateTime.now().second ~/ 2 == 0 ? true : false,
|
||||
isPublic = DateTime.now().second ~/ 2 == 0 ? true : false,
|
||||
parentId = randomId(),
|
||||
externalLink = 'Random external link ${randomId()}',
|
||||
|
@ -138,7 +138,7 @@ class TimelineEntry {
|
|||
modificationTimestamp:
|
||||
modificationTimestamp ?? this.modificationTimestamp,
|
||||
id: id ?? this.id,
|
||||
isReshare: isReshare ?? this.isReshare,
|
||||
youReshared: isReshare ?? this.youReshared,
|
||||
isPublic: isPublic ?? this.isPublic,
|
||||
parentId: parentId ?? this.parentId,
|
||||
externalLink: externalLink ?? this.externalLink,
|
||||
|
@ -163,11 +163,11 @@ class TimelineEntry {
|
|||
|
||||
@override
|
||||
String toString() {
|
||||
return 'TimelineEntry{id: $id, isReshare: $isReshare, isFavorited: $isFavorited, parentId: $parentId, creationTimestamp: $creationTimestamp, modificationTimestamp: $modificationTimestamp, backdatedTimeStamp: $backdatedTimestamp, post: $body, title: $title, author: $author, parentAuthor: $parentAuthor externalLink:$externalLink}';
|
||||
return 'TimelineEntry{id: $id, isReshare: $youReshared, isFavorited: $isFavorited, parentId: $parentId, creationTimestamp: $creationTimestamp, modificationTimestamp: $modificationTimestamp, backdatedTimeStamp: $backdatedTimestamp, post: $body, title: $title, author: $author, parentAuthor: $parentAuthor externalLink:$externalLink}';
|
||||
}
|
||||
|
||||
String toShortString() {
|
||||
return 'TimelineEntry{id: $id, isReshare: $isReshare, isFavorited: $isFavorited, parentId: $parentId, $engagementSummary}';
|
||||
return 'TimelineEntry{id: $id, isReshare: $youReshared, isFavorited: $isFavorited, parentId: $parentId, $engagementSummary}';
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -187,7 +187,7 @@ class TimelineEntry {
|
|||
body == other.body &&
|
||||
title == other.title &&
|
||||
spoilerText == other.spoilerText &&
|
||||
isReshare == other.isReshare &&
|
||||
youReshared == other.youReshared &&
|
||||
isPublic == other.isPublic &&
|
||||
author == other.author &&
|
||||
authorId == other.authorId &&
|
||||
|
@ -214,7 +214,7 @@ class TimelineEntry {
|
|||
body.hashCode ^
|
||||
title.hashCode ^
|
||||
spoilerText.hashCode ^
|
||||
isReshare.hashCode ^
|
||||
youReshared.hashCode ^
|
||||
isPublic.hashCode ^
|
||||
author.hashCode ^
|
||||
authorId.hashCode ^
|
||||
|
|
|
@ -52,7 +52,7 @@ extension TimelineEntryFriendicaExtensions on TimelineEntry {
|
|||
backdatedTimestamp: backdatedTimestamp,
|
||||
locationData: actualLocationData,
|
||||
body: body,
|
||||
isReshare: isReshare,
|
||||
youReshared: isReshare,
|
||||
isPublic: isPublic,
|
||||
id: id,
|
||||
parentId: parentId,
|
||||
|
|
|
@ -54,8 +54,9 @@ extension NotificationMastodonExtension on UserNotification {
|
|||
final baseContent = type == NotificationType.mention
|
||||
? "${from.name} ${type.toVerb()}"
|
||||
: "${from.name} ${type.toVerb()} ${status.author}'s";
|
||||
final shareInfo =
|
||||
status.isReshare ? "reshare of ${status.reshareAuthor}'s" : '';
|
||||
final shareInfo = status.reshareAuthorId.isNotEmpty
|
||||
? "reshare of ${status.reshareAuthor}'s"
|
||||
: '';
|
||||
content =
|
||||
"$baseContent $shareInfo $referenceType: ${status.body.truncate(length: 64)}";
|
||||
break;
|
||||
|
|
|
@ -25,6 +25,7 @@ extension TimelineEntryMastodonExtensions on TimelineEntry {
|
|||
})
|
||||
: 0;
|
||||
final id = json['id'] ?? '';
|
||||
final youReshared = json['reblogged'] ?? false;
|
||||
final isPublic = json['visibility'] == 'public';
|
||||
final parentId = json['in_reply_to_id'] ?? '';
|
||||
final parentAuthor = json['in_reply_to_account_id'] ?? '';
|
||||
|
@ -60,16 +61,13 @@ extension TimelineEntryMastodonExtensions on TimelineEntry {
|
|||
|
||||
late final String reshareAuthor;
|
||||
late final String reshareAuthorId;
|
||||
late final bool isReshare;
|
||||
if (json['reblog'] != null) {
|
||||
isReshare = true;
|
||||
final rebloggedUser =
|
||||
ConnectionMastodonExtensions.fromJson(json['reblog']['account']);
|
||||
connectionManager.addConnection(rebloggedUser);
|
||||
reshareAuthor = rebloggedUser.name;
|
||||
reshareAuthorId = rebloggedUser.id;
|
||||
} else {
|
||||
isReshare = false;
|
||||
reshareAuthorId = '';
|
||||
reshareAuthor = '';
|
||||
}
|
||||
|
@ -90,7 +88,7 @@ extension TimelineEntryMastodonExtensions on TimelineEntry {
|
|||
locationData: actualLocationData,
|
||||
spoilerText: spoilerText,
|
||||
body: body,
|
||||
isReshare: isReshare,
|
||||
youReshared: youReshared,
|
||||
isPublic: isPublic,
|
||||
id: id,
|
||||
parentId: parentId,
|
||||
|
|
Ładowanie…
Reference in New Issue