-
-
Notifications
You must be signed in to change notification settings - Fork 21
Invite people to take over a task #3055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
anisha-e10
wants to merge
30
commits into
main
Choose a base branch
from
anisha/invite-task
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
a0f0a9e
setup for task invitation
anisha-e10 e7179ef
Merge remote-tracking branch 'origin/main' into anisha/invite-task
anisha-e10 4120230
callback and providers added
anisha-e10 8d412f7
callback added
anisha-e10 28c7557
view invited users list
anisha-e10 cdd29d0
text changes
anisha-e10 64bd50a
Merge remote-tracking branch 'refs/remotes/origin/main' into anisha/i…
anisha-e10 cf5e8b4
notifiers added
anisha-e10 1fd04d2
managed UI
anisha-e10 d5e331e
managed actions
anisha-e10 acd609d
invite and invited actions added when user is invited for task
anisha-e10 38516d0
modified code structure of task assignment and task invitations
anisha-e10 177129e
assignment and invitations test cases
anisha-e10 91e0739
notifier test added for task and invitations
anisha-e10 a544d49
task item test resolved
anisha-e10 4713403
user builder test added
anisha-e10 bd70ce5
space detail page test cases solved
anisha-e10 75da519
lint error
anisha-e10 bce5fcf
fix invitation item widget test cases mock data
anisha-e10 6b3910a
solved mock data
anisha-e10 10d3cb9
invite actions test added
anisha-e10 437b908
Merge remote-tracking branch 'origin/main' into anisha/invite-task
anisha-e10 a97f607
Merge remote-tracking branch 'refs/remotes/origin/main' into anisha/i…
anisha-e10 3422798
Merge remote-tracking branch 'refs/remotes/origin/main' into anisha/i…
anisha-e10 a7b9f53
Added view and notifier to check the user is invited or provide accep…
anisha-e10 f431b9d
text changes
anisha-e10 c0c3104
assign and unassign test cases added
anisha-e10 b4e338e
test cases added that cover all line of code
anisha-e10 beabef5
added test for accept and decline view
anisha-e10 be39519
task assignment widget remaining test added
anisha-e10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import 'package:acter/common/providers/room_providers.dart'; | ||
| import 'package:acter/l10n/generated/l10n.dart'; | ||
| import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart'; | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_easyloading/flutter_easyloading.dart'; | ||
| import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
|
||
| class InviteActions { | ||
| static Future<void> handleInvite({ | ||
| required BuildContext context, | ||
| required WidgetRef ref, | ||
| required String userId, | ||
| required Room room, | ||
| Task? task, | ||
| }) async { | ||
| final lang = L10n.of(context); | ||
| EasyLoading.show(status: lang.invitingLoading(userId), dismissOnTap: false); | ||
| try { | ||
| if (task != null) { | ||
| final invitationsManager = await task.invitations(); | ||
| await invitationsManager.invite(userId); | ||
| } else { | ||
| await room.inviteUser(userId); | ||
| } | ||
| EasyLoading.dismiss(); | ||
| } catch (e) { | ||
| // ignore: use_build_context_synchronously | ||
| EasyLoading.showToast(lang.invitingError(e, userId)); | ||
| } | ||
| } | ||
|
|
||
| static Future<void> handleCancelInvite({ | ||
| required BuildContext context, | ||
| required WidgetRef ref, | ||
| required String userId, | ||
| required Room room, | ||
| }) async { | ||
| final lang = L10n.of(context); | ||
| EasyLoading.show( | ||
| status: lang.cancelInviteLoading(userId), | ||
| dismissOnTap: false, | ||
| ); | ||
| try { | ||
| final member = ref.read(memberProvider((userId: userId, roomId: room.roomIdStr()))).valueOrNull; | ||
|
|
||
| if (member != null) { | ||
| await member.kick('Cancel Invite'); | ||
| } | ||
| EasyLoading.dismiss(); | ||
| } catch (e) { | ||
| // ignore: use_build_context_synchronously | ||
| EasyLoading.showToast(lang.cancelInviteError(e, userId)); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import 'package:acter/features/notifications/actions/autosubscribe.dart'; | ||
| import 'package:acter/l10n/generated/l10n.dart'; | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_easyloading/flutter_easyloading.dart'; | ||
| import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
| import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart'; | ||
| import 'package:logging/logging.dart'; | ||
|
|
||
| final _log = Logger('AssignUnassignTask'); | ||
|
|
||
| Future<void> onAssign(BuildContext context, WidgetRef ref, Task task) async { | ||
| final lang = L10n.of(context); | ||
| EasyLoading.show(status: lang.assigningSelf); | ||
| try { | ||
| await task.assignSelf(); | ||
| await autosubscribe(ref: ref, objectId: task.eventIdStr(), lang: lang); | ||
| EasyLoading.showToast(lang.assignedYourself); | ||
| } catch (e, s) { | ||
| _log.severe('Failed to self-assign task', e, s); | ||
| if (!context.mounted) { | ||
| EasyLoading.dismiss(); | ||
| return; | ||
| } | ||
| EasyLoading.showError( | ||
| lang.failedToAssignSelf(e), | ||
| duration: const Duration(seconds: 3), | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| Future<void> onUnAssign(BuildContext context, WidgetRef ref, Task task) async { | ||
| final lang = L10n.of(context); | ||
| EasyLoading.show(status: lang.unassigningSelf); | ||
| try { | ||
| await task.unassignSelf(); | ||
| await autosubscribe(ref: ref, objectId: task.eventIdStr(), lang: lang); | ||
| EasyLoading.showToast(lang.assignmentWithdrawn); | ||
| } catch (e, s) { | ||
| _log.severe('Failed to self-unassign task', e, s); | ||
| if (!context.mounted) { | ||
| EasyLoading.dismiss(); | ||
| return; | ||
| } | ||
| EasyLoading.showError( | ||
| lang.failedToUnassignSelf(e), | ||
| duration: const Duration(seconds: 3), | ||
| ); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.