Skip to content
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

Teams theme - Accessing Moodle via Teams Integration also changes the theme on web access #1278

Open
sgodbehere01 opened this issue Jun 30, 2020 · 6 comments
Assignees
Labels
Feature - teams integration Issue type - enhancement request New feature being requested outside of original scope. Plugin - local_o365 Plugin - theme_boost_o365teams Status - queued / not yet started The request is clear, but the work has yet to be scheduled.

Comments

@sgodbehere01
Copy link

Hi there,

This may simply be part of how the plug-in works as intended so apologies if that's the case but I'm unsure.

When using the Teams theme via the Web app or Desktop app and accessing Moodle, if the user opens a session outside of Teams for Moodle this appears to have also changed the Moodle's theme for that user to the Teams theme until the user has both exited the Moodle tab on teams and also logged out and back onto Moodle. Should the user be able to view the Moodle outside of teams with the "normal" theme whilst simultaneously view it in teams with the teams theme?

Kind regards,

Sam

@tristdac
Copy link

tristdac commented Jul 2, 2020

Hi Sam.

I noticed the same thing and agree that i hope this is not expected behaviour.

In Teams, the o365_boost theme is set for the user session, but if roaming back and forth between Teams & Moodle and the user session has been set to display teams theme, it fails when viewing Moodle directly via browser (outside of Teams). In our case, it actually falls back to Boost theme instead of the selected site theme for some reason.

@cbrherms
Copy link

cbrherms commented Aug 3, 2020

There is a check written in to it but looks like it's failing to notice that it's no longer in an iframe/mobile app and doesn't send it through the redirect.

if (!inIframe() && !isMobileApp()) {
window.location.href = "' . $redirecturl->out(false) . '";
}

@weilai-irl
Copy link
Collaborator

Hi @sgodbehere01, @tristdac, @cbrherms

As the maintainer of the plugin, I confirm this is a known issue, and a technical solution to the issue is unlikely to be available.

As @tristdac pointed out, the root of the issue is Moodle saves the theme to be used when a user accesses a Moodle page in session, and would use the theme until the session expires, or a change is made to the session to tell it to use a different theme. When a user accesses a Moodle tab from teams, the user effectively visits /local/o365/teams_tab.php, and it is on this page where the theme of the session is set, which means all future Moodle page visits in the same session will use theme_boost_o365teams. There is a new setting to disable this, but that's a different topic.

So this means - if a user is using Teams from a browser window (i.e. Teams web app), all direct access to the Moodle page after loading any Moodle tab will use theme_boost_o365teams. This will NOT happen if Teams desktop or mobile apps are used though, because the desktop or mobile apps uses separate browser sessions as desktop browser or mobile browsers, therefore theme session variables made from desktop or mobile apps are not used by browsers.

In theory, it should be possible to perform a check to see if the user's access to Moodle is from Teams web app, and revert to the default theme if not (thus achieving reverting back to normal theme); however, this cannot be achieved in a theme plugin, and would require Moodle core code change. Considering the potential impact of this change (which will require addition checks on every Moodle page load), it's unlikely that this will be accepted by Moodle core, therefore a decision was made to keep it as is.

I hope this clarify the situation about the known issue better.

Regards,
Lai

@weilai-irl
Copy link
Collaborator

There is a check written in to it but looks like it's failing to notice that it's no longer in an iframe/mobile app and doesn't send it through the redirect.

if (!inIframe() && !isMobileApp()) {
window.location.href = "' . $redirecturl->out(false) . '";
}

Hi @cbrherms , the code snippet you referred is used to prevent direct access to Moodle teams tab content page, which should only be accessed from either Teams web app, or desktop/mobile app. It's unrelated to the issue in this post.

Regards,
Lai

@cbrherms
Copy link

cbrherms commented Aug 3, 2020

Hi @cbrherms , the code snippet you referred is used to prevent direct access to Moodle teams tab content page, which should only be accessed from either Teams web app, or desktop/mobile app. It's unrelated to the issue in this post.

Regards,
Lai

My bad. I misinterpreted while trying to connect some dots.

Thanks for the in depth explanation though. It's greatly appreciated!

@tristdac
Copy link

tristdac commented Aug 3, 2020

Thanks for clarification @weilai-irl .

A potential solution would be to do it all with css/js. So add a few lines of js to identify if the page/site is loaded within an iframe in the teams tab, and add a class to the page body.

When setting the theme to use in teams, just assign the same theme you are currently using as your main theme on the site.

You could then write some css based on this extra body class which looks the way you like. Ie no navbar, flatnav or block region. You could even style it in the o365 teams theme way.

This way, your not changing any theme at any time and users are free to roam back and forth between Teams and Moodle without any session theme issues. Your simply adding a class to a page which renders a whole new set of styles.

The main site theme we use (RemUI) has something the developer calls "focus mode" which simply adds the class "focusmode" to the body tag. It works well as a simplified version of the course page and I can force it on when viewing inside teams with a few lines of js.

A standardised method like this may be difficult to implement as everyone potentially uses a different theme, but perhaps a standard Boost version could be possible.

@weilai-irl weilai-irl self-assigned this Jan 8, 2021
@weilai-irl weilai-irl added Feature - teams integration Issue type - enhancement request New feature being requested outside of original scope. Plugin - local_o365 Plugin - theme_boost_o365teams Status - queued / not yet started The request is clear, but the work has yet to be scheduled. labels Jul 27, 2021
@nenorojas nenorojas assigned audrieMSFT and unassigned weilai-irl Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature - teams integration Issue type - enhancement request New feature being requested outside of original scope. Plugin - local_o365 Plugin - theme_boost_o365teams Status - queued / not yet started The request is clear, but the work has yet to be scheduled.
Projects
None yet
Development

No branches or pull requests

5 participants