From 756656f3d077b85cd33bfd8021ad03ed7665fadb Mon Sep 17 00:00:00 2001 From: Stephen Brough Date: Wed, 13 May 2020 16:22:01 -0600 Subject: [PATCH] [Student][Hotfix-6.7.1] Another Student view fix and block messaging from People details (#805) --- .../student/activity/NavigationActivity.kt | 2 +- .../student/fragment/PeopleDetailsFragment.kt | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/student/src/main/java/com/instructure/student/activity/NavigationActivity.kt b/apps/student/src/main/java/com/instructure/student/activity/NavigationActivity.kt index 1f6ac31e30..1b629d8e68 100644 --- a/apps/student/src/main/java/com/instructure/student/activity/NavigationActivity.kt +++ b/apps/student/src/main/java/com/instructure/student/activity/NavigationActivity.kt @@ -135,7 +135,7 @@ class NavigationActivity : BaseRouterActivity(), Navigation, MasqueradingDialog. }, route) } R.id.navigationDrawerItem_changeUser -> { - StudentLogoutTask(LogoutTask.Type.SWITCH_USERS).execute() + StudentLogoutTask(if (ApiPrefs.isStudentView) LogoutTask.Type.LOGOUT else LogoutTask.Type.SWITCH_USERS).execute() } R.id.navigationDrawerItem_logout -> { AlertDialog.Builder(this@NavigationActivity) diff --git a/apps/student/src/main/java/com/instructure/student/fragment/PeopleDetailsFragment.kt b/apps/student/src/main/java/com/instructure/student/fragment/PeopleDetailsFragment.kt index b64ce6842b..4f438cdf56 100644 --- a/apps/student/src/main/java/com/instructure/student/fragment/PeopleDetailsFragment.kt +++ b/apps/student/src/main/java/com/instructure/student/fragment/PeopleDetailsFragment.kt @@ -27,6 +27,7 @@ import com.instructure.canvasapi2.models.BasicUser import com.instructure.canvasapi2.models.CanvasContext import com.instructure.canvasapi2.models.Course import com.instructure.canvasapi2.models.User +import com.instructure.canvasapi2.utils.ApiPrefs import com.instructure.canvasapi2.utils.Pronouns import com.instructure.canvasapi2.utils.displayType import com.instructure.canvasapi2.utils.isValid @@ -42,6 +43,7 @@ import com.instructure.interactions.router.Route import com.instructure.interactions.router.RouterParams import com.instructure.pandautils.utils.* import com.instructure.student.R +import com.instructure.student.activity.NothingToSeeHereFragment import com.instructure.student.router.RouteMatcher import kotlinx.android.synthetic.main.fragment_people_details.* import java.util.ArrayList @@ -74,9 +76,13 @@ class PeopleDetailsFragment : ParentFragment(), Bookmarkable { compose.setIconDrawable(ColorKeeper.getColoredDrawable(requireContext(), R.drawable.vd_send, Color.WHITE)) compose.setOnClickListener { - val participants = ArrayList() - participants.add(BasicUser.userToBasicUser(user!!)) - val route = InboxComposeMessageFragment.makeRoute(canvasContext, participants) + // Messaging other users is not available in Student view + val route = if (ApiPrefs.isStudentView) NothingToSeeHereFragment.makeRoute() else { + val participants = ArrayList() + participants.add(BasicUser.userToBasicUser(user!!)) + InboxComposeMessageFragment.makeRoute(canvasContext, participants) + } + RouteMatcher.route(requireContext(), route) } when {