kopia lustrzana https://gitlab.com/mysocialportal/relatica
Fix unfindable context on reshared posts in 2023.04 by looking at parentId as well
rodzic
d586ee3206
commit
1d63f7d0f0
|
@ -419,16 +419,35 @@ class EntryManagerService extends ChangeNotifier {
|
|||
_logger.finest('Refreshing post: $id');
|
||||
final client = StatusesClient(getIt<AccountsService>().currentProfile);
|
||||
final idForCall = mapInteractionId(id);
|
||||
var parentId = '';
|
||||
final result = await client
|
||||
.getPostOrComment(idForCall, fullContext: false)
|
||||
.withResult((entries) =>
|
||||
parentId = entries.isEmpty ? '' : entries.first.parentId ?? '')
|
||||
.andThenAsync((rootItems) async => await client
|
||||
.getPostOrComment(idForCall, fullContext: true)
|
||||
.andThenSuccessAsync(
|
||||
(contextItems) async => [...rootItems, ...contextItems]))
|
||||
.andThenSuccessAsync((items) async {
|
||||
.withResult((items) async {
|
||||
await processNewItems(items, client.profile.username, null);
|
||||
});
|
||||
|
||||
if (parentId.isNotEmpty &&
|
||||
getIt<FriendicaVersionChecker>()
|
||||
.canUseFeature(RelaticaFeatures.reshareIdFix)) {
|
||||
final parentIdForCall = mapInteractionId(parentId);
|
||||
await client
|
||||
.getPostOrComment(parentIdForCall, fullContext: false)
|
||||
.withResult((entries) =>
|
||||
parentId = entries.isEmpty ? '' : entries.first.parentId ?? '')
|
||||
.andThenAsync((rootItems) async => await client
|
||||
.getPostOrComment(idForCall, fullContext: true)
|
||||
.transformAsync(
|
||||
(contextItems) async => [...rootItems, ...contextItems]))
|
||||
.withResult((items) async {
|
||||
await processNewItems(items, client.profile.username, null);
|
||||
});
|
||||
}
|
||||
return result.mapValue((_) {
|
||||
_logger.finest('$id post updated');
|
||||
return _nodeToTreeItem(_getPostRootNode(id)!, client.profile.userId);
|
||||
|
|
Ładowanie…
Reference in New Issue