4546 course activities not shown to newly joined member (#4549)

* fix: wait for room in sync after joining via invite dialog before navigating to detail page

* fix: render end button and text explanation using the samel logic, don't show activity stats menu instruction popup if user has finished actiivty

* fix: don't redirect from out space on delete child room

* fix: don't clear localized course cache of target language update
This commit is contained in:
ggurdin 2025-10-30 09:57:17 -04:00 committed by GitHub
parent 71e7f9217e
commit 7273b595fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 29 additions and 7 deletions

View file

@ -78,8 +78,10 @@ class _ActivityStatsButtonState extends State<ActivityStatsButton> {
// if someone has finished the activity, enable the tooltip
final activityRoles =
widget.controller.room.activityRoles?.roles.values.toList() ?? [];
if (activityRoles.any((r) => r.isFinished)) {
return true;
final finishedRoles = activityRoles.where((r) => r.isFinished).toList();
if (finishedRoles.isNotEmpty) {
return !finishedRoles.any((r) => r.userId == _client.userID);
}
// otherwise, if no one has finished, only show if the user has sent >= 3 messages

View file

@ -196,7 +196,7 @@ class ActivityStatsMenuState extends State<ActivityStatsMenu> {
),
],
),
if (!room.hasArchivedActivity)
if (!userComplete) ...[
Text(
L10n.of(context).activityDropdownDesc,
textAlign: TextAlign.center,
@ -205,7 +205,6 @@ class ActivityStatsMenuState extends State<ActivityStatsMenu> {
fontWeight: FontWeight.w600,
),
),
if (!userComplete) ...[
if (shouldShowEndForAll)
ElevatedButton(
style: ElevatedButton.styleFrom(

View file

@ -76,6 +76,10 @@ Future<void> showInviteDialog(Room room, BuildContext context) async {
);
if (joinResult.error != null) return;
if (room.membership != Membership.join) {
await room.client.waitForRoomInSync(room.id, join: true);
}
context.go(
room.isSpace ? "/rooms/spaces/${room.id}/details" : "/rooms/${room.id}",
);

View file

@ -271,6 +271,7 @@ void chatContextMenuAction(
context.go("/rooms");
}
} else {
final parentSpaceId = room.courseParent?.id;
final confirmed = await showOkCancelAlertDialog(
context: context,
title: l10n.areYouSure,
@ -286,8 +287,8 @@ void chatContextMenuAction(
);
if (!resp.isError) {
outerContext.go(
room.courseParent != null
? "/rooms/spaces/${room.courseParent!.id}/details"
parentSpaceId != null
? "/rooms/spaces/$parentSpaceId/details"
: "/rooms",
);
}

View file

@ -233,7 +233,23 @@ class PangeaController {
}
Future<void> _onLanguageUpdate(LanguageUpdate update) async {
clearCache(exclude: ["analytics_storage"]);
final exclude = [
'analytics_storage',
'course_location_media_storage',
'course_location_storage',
'course_media_storage',
];
// only clear course data if the base language has changed
if (update.prevBaseLang == update.baseLang) {
exclude.addAll([
'course_storage',
'course_topic_storage',
'course_activity_storage',
]);
}
clearCache(exclude: exclude);
_updateBotOptions();
}