mitodl / ocw-studio

Open Source Courseware authoring tool
BSD 3-Clause "New" or "Revised" License
9 stars 3 forks source link

resources are always added by "OCW Studio Bot" in the git commit log #1753

Open pdpinch opened 1 year ago

pdpinch commented 1 year ago

Steps to Reproduce

  1. Log into Studio with your user
  2. Create a site and sync some resources from gdrive, for example: https://ocw-studio-rc.odl.mit.edu/sites/peters-test-site-for-unpbulishing/type/resource/
  3. Take a look at the commit history in github, for example: https://github.mit.edu/ocw-content-rc/test101-spring-2023/commits/main

Expected Behavior

Actual Behavior

Screenshot or Screencast

image

pt2302 commented 1 year ago

It looks like "OCW Studio Bot" was made the default for "anonymous commits" in this PR: https://github.com/mitodl/salt-ops/pull/1523, in response to this issue: https://github.com/mitodl/ocw-studio/issues/1269.

pdpinch commented 1 year ago

Thanks for the context, but I don't see why these commits that add resources should be "anonymous" since there is a logged in user who clicks the "sync w/Google drive" button.

pt2302 commented 1 year ago

That is indeed surprising. Here is the relevant code that checks whether the user is anonymous: https://github.com/mitodl/ocw-studio/blob/c74cc6ff031d9913a0672d16db45ec5b1bba4880/content_sync/apis/github.py#L422-L435

In production, features.is_enabled(features.GIT_ANONYMOUS_COMMITS) is False. However, the default user is Anonymous: https://github.com/mitodl/ocw-studio/blob/c74cc6ff031d9913a0672d16db45ec5b1bba4880/main/settings.py#L934-L945 Not sure why the logged-in user information is not getting passed through.