Skip to content

Commit

Permalink
[Student][Hotfix-6.7.1] Another Student view fix and block messaging …
Browse files Browse the repository at this point in the history
…from People details (#805)
  • Loading branch information
StephenBrough authored May 13, 2020
1 parent 555be42 commit 756656f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -74,9 +76,13 @@ class PeopleDetailsFragment : ParentFragment(), Bookmarkable {

compose.setIconDrawable(ColorKeeper.getColoredDrawable(requireContext(), R.drawable.vd_send, Color.WHITE))
compose.setOnClickListener {
val participants = ArrayList<BasicUser>()
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<BasicUser>()
participants.add(BasicUser.userToBasicUser(user!!))
InboxComposeMessageFragment.makeRoute(canvasContext, participants)
}

RouteMatcher.route(requireContext(), route)
}
when {
Expand Down

0 comments on commit 756656f

Please sign in to comment.