-
Notifications
You must be signed in to change notification settings - Fork 51
Classroom abilities + create studio + misc #294
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
Conversation
…or is a builtin so i renamed it, also i fixed a typo in cloud_requests.py
fixed image in pypi info page
…tatus (wiwo for classes)
more potential features: |
I will add the parser for private class activity first |
there is now a parser for the private activity. no parser for alerts tho |
here is the reference file i used to build that parser: <script type="text/template" id="template-activity-list-item">
<% switch(type)
{ case 0: %>
<span class="icon-xs black follow"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
followed user
<a href="/users/<%- followed_username %>"><%- followed_username %></a>
<% break; case 1: %>
<span class="icon-xs black follow"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
followed studio
<a href="/studios/<%- gallery %>"><%- title %></a>
<% break; case 2: %>
<span class="icon-xs black love"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
loved the project
<a href="/projects/<%- project %>"><%- title %></a>
<% break; case 3: %>
<span class="icon-xs black favorite"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
favorited the project
<a href="/projects/<%- project %>"><%- project_title %></a>
<% break; case 7: %>
<span class="icon-xs black project"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
added the project
<a href="/projects/<%- project %>"><%- project_title %></a>
to studio
<a href="/studios/<%- gallery %>"><%- gallery_title %></a>
<% break; case 8: %>
<% break; case 9: %>
<% break; case 10: %>
<span class="icon-xs black project"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
<% if (is_reshare) { %>
shared the project
<% } else { %>
reshared the project
<% } %>
<a href="/projects/<%- project %>"><%- title %></a>
<% break; case 11: %>
<span class="icon-xs black project"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
remixed the project
<a href="/projects/<%- project %>"><%- title %></a>
<% break; case 13: %>
<span class="icon-xs black project"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
added the studio
<a href="/studios/<%- gallery %>">Untitled Studio</a>
<% break; case 15: %>
<span class="icon-xs black project"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
updated the studio
<a href="/studios/<%- gallery %>"><%- title %></a>
<% break; case 16: %>
<% break; case 17: %>
<% break; case 18: %>
<% break; case 19: %>
<span class="icon-xs black project"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
removed the project
<a href="/projects/<%- project %>"><%- project_title %></a>
from studio
<a href="/studios/<%- gallery %>"><%- gallery_title %></a>
<% break; case 20: %>
<% break; case 21: %>
<% break; case 22: %>
<span class="icon-xs black follow"></span>
<a href="/users/<%- recipient_username %>"><%- recipient_username %></a>
was promoted to manager by
<a href="/users/<%- actor_username %>"><%- actor_username %></a>
for studio
<a href="/studios/<%- gallery %>"><%- gallery_title %></a>
<% break; case 23: %>
<% break; case 24: %>
<% break; case 25: %>
<span class="icon-xs black project"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
made a profile update. <em></em>
<% break; case 26: %>
<% break; case 27: %>
<span class="icon-xs black comment"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
<% if (comment_type === 0) { %>
commented on the project
<a href="/projects/<%- comment_obj_id %>"><%- comment_obj_title %></a>
<%
// format the direct link to the comment (used in the comment block below)
var comment_reply_link = '/projects/' + comment_obj_id + '/#comments-' + comment_id
%>
<% } %>
<% if (comment_type === 1) { %>
commented on user
<a href="/users/<%- comment_obj_title %>"><%- comment_obj_title %></a>
<%
// format the direct link to the comment (used in the comment block below)
var comment_reply_link = '/users/' + comment_obj_title + '/#comments-' + comment_id
%>
<% } %>
<% if (comment_type === 2) { %>
commented on the studio
<a href="/studios/<%- comment_obj_id %>"><%- comment_obj_title %></a>
<%
// format the direct link to the comment (used in the comment block below)
var comment_reply_link = '/studios/' + comment_obj_id + '/#comments-' + comment_id
%>
<% } %>
<% break; default: %>
<span class="icon-xs black project"></span>
<a href="/users/<%- actor.username %>"><%- actor.username %></a>
performed an action. <em> <%- type %></em>
<% break;} %>
<span class="time"><span class="media-info-item date shortDateFormat last"><%- $.format.date(datetime_created, "MM/dd/yyyy") %></span></span>
<% if (typeof comment_fragment !== 'undefined') { %>
<div class="comment-block">
<span class="comment-text"><%- comment_fragment %></span>
<a class="reply" href="<%= comment_reply_link %>"> <span>Reply</span> </a>
</div>
<% } %>
</script>
<script type="text/template" id="template-alert-list-item">
<div class="alert-item-content" data-alert-id="<%- id %>">
<span class="alert-icon small"></span>
<% switch(admin_action.type)
{ case 0: %>
<a href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
banned.
<% break; case 1: %>
<a href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
unbanned.
<% break; case 2: %>
<a href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
excluded from homepage.
<% break; case 3: %>
<a href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
excluded from homepage.
<% break; case 4: %>
<a href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
notified by a Scratch Administrator. Notification Type: <%- admin_action.extra_data.notification_type ||
'Unknown' %>
<% break; case 5: %>
<a href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
banned automatically.
<% break; case 6: %>
<a href='/projects/<%- admin_action.object_id %>'><%- admin_action.extra_data.project_title %></a> by <a
href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
removed automatically.
<% break; case 7: %>
<% case 20: %>
<a href='/projects/<%- admin_action.object_id %>'><%- admin_action.extra_data.project_title %></a> by <a
href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
censored.
<% break; case 8: %>
<a href='/projects/<%- admin_action.object_id %>'><%- admin_action.extra_data.project_title %></a> by <a
href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
uncensored.
<% break; case 9: %>
<% case 10: %>
<a href='/projects/<%- admin_action.object_id %>'><%- admin_action.extra_data.project_title %></a> by <a
href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
reviewed by a Scratch Administrator.
<% break; case 11: %>
<a href='/projects/<%- admin_action.object_id %>'><%- admin_action.extra_data.project_title %></a> by <a
href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
deleted by a Scratch Administrator.
<% break; case 12: %>
<% case 17: %>
<a href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
deleted by a Scratch Administrator.
<% break; case 13: %>
<% case 14: %>
<a href='/studios/<%- admin_action.object_id %>'><%- admin_action.extra_data.gallery_title %></a> was reviewed
by a Scratch Administrator.
<% break; case 15: %>
<a href='/studios/<%- admin_action.object_id %>'><%- admin_action.extra_data.gallery_title %></a> was deleted by
a Scratch Administrator.
<% break; case 16: %>
<a href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> deleted
their own account.
<% break; case 18: %>
The email address of <a href='/users/<%- admin_action.target_user.username %>'><%-
admin_action.target_user.username %></a> was confirmed by a Scratch Administrator
<% break; case 19: %>
The email address of <a href='/users/<%- admin_action.target_user.username %>'><%-
admin_action.target_user.username %></a> was set as not confirmed by a Scratch Administrator
<% break; case 22: %>
<% if(typeof admin_action.extra_data.comment_content == 'undefined'){ %>
<a href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
automatically muted by our comment filters.
<% } else { %>
<a href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> was
automatically muted by our comment filters. The comment they tried to post was: <i><%-
admin_action.extra_data.comment_content.content %></i>
<% } %>
<% break; default: %>
<a href='/users/<%- admin_action.target_user.username %>'><%- admin_action.target_user.username %></a> had an
admin action performed. <em><%- admin_action.type %></em>
<% break;} %>
<span class="time"><span class="media-info-item date shortDateFormat last"><%- $.format.date(admin_action.datetime_created, "MM/dd/yyyy") %></span></span>
<% if(typeof classroom_names !== 'undefined'){ %>
<div class="alert-classroom-data">Classes: <em><%- classroom_names %></em></div>
<% } %>
<% if(this.allowHideAlerts) { %>
<span data-control="hide-alert" data-message-id="<%= admin_action.message %>" class="delete">x</span>
<% } %>
</div>
</script> |
Signed-off-by: faretek <107722825+FAReTek1@users.noreply.github.com>
I think that some tester code should be written to make sure that scratchattach is running fine. It makes me very scared whenever I make large merges like this, especially with all of the conflicts that I have to solve |
well, as long as it isn't pushed to pypi yet, it is safe to debug and fix? |
merging it now reduces the chances of more issues to crop up |
i now want to make some tester algorithm that asserts that everything is functioning as usual. however it will be quite complicated to code |
i realise now, the empty cases are actually relaying onto the next case statement. this needs to be fixed |
fixed in my upcoming pr |
New classroom abilities
Adds a wide array of capabilities for scratch's classroom system, including:
Other new abilities
create_studio()
Added the
Session.create_studio()
function to create studios to solve an issue (#277). I copy+pasted rate limit code fromSession.create_project()
. Also added title/desc settings to make it more convenientexceptions
exceptions.Unauthorized()
so that you can add more detail to the exception if need be. When receiving a 403/401 status code in therequests
wrapper, it will now print the request content which will sometimes be more descriptive than simply: "You are unauthorised"ConnectionError
toCloudConnectionError
sinceConnectionError
is actually a builtin errormisc changes/features
other_apis.py
commons.webscrape_count
Extra Note(s)
cloud_requests.py
, I fixed a typo ofself.call_even
, changing it toself.call_event
. In the rare case this is intentional, now you knowfrom __future__ import annotations
so that may need to be fixed