-
Notifications
You must be signed in to change notification settings - Fork 0
augmentedreality: add guest users #23
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
91d2536
apps:comments add comments app add urls und add in settings+ recreate…
1e70f21
Add relevant guest user changes from roots
partizipation 1ca85a5
Add guest user created on non auth comment
partizipation b3f1c4a
Add ratings url and viewset
partizipation f4ae1a4
start addings ar tests
partizipation db1fef2
Add migration after rebase
partizipation 3c944ac
Add ar test works after rebase
partizipation d21834a
Clean up and move ar guest test
partizipation 71f1a4d
Fix urls
partizipation f30edd7
Add changelog
partizipation 8e1da45
Remove comments app
partizipation f63c90c
Add a4 branch off hash to package.json
partizipation 564e515
Add back package-lock.json (newly generated)
partizipation c4211f8
Remove extra filter calls, remove http methods, remove comment
partizipation File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,14 @@ | ||
| from guest_user.mixins import AllowGuestUserMixin | ||
|
|
||
| from adhocracy4.comments_async.api import CommentViewSet | ||
| from adhocracy4.ratings.api import RatingViewSet | ||
|
|
||
|
|
||
| class CombinedRatingViewSet(AllowGuestUserMixin, RatingViewSet): | ||
| http_method_names = ["post", "patch"] | ||
|
|
||
|
|
||
| class CombinedCommentViewSet(CommentViewSet): | ||
| class CombinedCommentViewSet(AllowGuestUserMixin, CommentViewSet): | ||
| def get_queryset(self): | ||
| comments = super().get_queryset() | ||
| return comments |
24 changes: 24 additions & 0 deletions
24
apps/augmentedreality/migrations/0005_alter_scene_content_type.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Generated by Django 4.2.18 on 2025-07-01 15:42 | ||
|
|
||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("contenttypes", "0002_remove_content_type_name"), | ||
| ("arpas_augmentedreality", "0004_alter_arobject_scene"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name="scene", | ||
| name="content_type", | ||
| field=models.ForeignKey( | ||
| on_delete=django.db.models.deletion.CASCADE, | ||
| related_name="scenes", | ||
| to="contenttypes.contenttype", | ||
| ), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| from adhocracy4.api import routers as a4routers | ||
|
|
||
| from .api import CombinedCommentViewSet | ||
| from .api import CombinedRatingViewSet | ||
|
|
||
| ct_router = a4routers.ContentTypeDefaultRouter() | ||
| ct_router.register(r"arpas_comments", CombinedCommentViewSet, basename="arpas_comments") | ||
| ct_router.register(r"arpas-comments", CombinedCommentViewSet, basename="arpas-comments") | ||
| ct_router.register(r"arpas-ratings", CombinedRatingViewSet, basename="arpas-ratings") | ||
|
|
||
| urlpatterns = ct_router.urls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,65 +1,77 @@ | ||
| {% load i18n static thumbnail settings %} | ||
| {% load i18n static thumbnail settings guest_user %} | ||
| {% if request.user.is_authenticated %} | ||
| <div class="dropdown userindicator__dropdown"> | ||
| <button title="{% translate 'Menu' %}" | ||
| class="d-md-none dropdown-toggle btn btn--secondary-filled btn--attached-top header-upper__mobile-toggle" | ||
| data-bs-toggle="dropdown" | ||
| data-flip="false" | ||
| aria-haspopup="true" | ||
| aria-expanded="false" | ||
| id="user-actions-mobile"> | ||
| <span class="d-none d-sm-inline-block pe-1">{% translate 'Menu' %}</span> | ||
| </button> | ||
| <button title="{% translate 'Menu' %}" | ||
| class="d-none d-md-inline-block dropdown-toggle btn btn--secondary-filled btn--attached-top btn--align-left header-upper__toggle" | ||
| data-bs-toggle="dropdown" | ||
| data-flip="false" | ||
| aria-haspopup="true" | ||
| aria-expanded="false" | ||
| id="user-actions"> | ||
| <div class="userindicator__btn-img" | ||
| style="background-image: {% if request.user.avatar %} url({{ request.user.avatar|thumbnail_url:'avatar' }}) {% else %} url({{ request.user.avatar_fallback }}) {% endif %}"> | ||
| {% with is_guest=user|is_guest_user %} | ||
| <div class="dropdown userindicator__dropdown"> | ||
| <button title="{% translate 'Menu' %}" | ||
| class="d-md-none dropdown-toggle btn btn--secondary-filled btn--attached-top header-upper__mobile-toggle" | ||
| data-bs-toggle="dropdown" | ||
| data-flip="false" | ||
| aria-haspopup="true" | ||
| aria-expanded="false" | ||
| id="user-actions-mobile"> | ||
| <span class="d-none d-sm-inline-block pe-1">{% translate 'Menu' %}</span> | ||
| </button> | ||
| <button title="{% translate 'Menu' %}" | ||
| class="d-none d-md-inline-block dropdown-toggle btn btn--secondary-filled btn--attached-top btn--align-left header-upper__toggle" | ||
| data-bs-toggle="dropdown" | ||
| data-flip="false" | ||
| aria-haspopup="true" | ||
| aria-expanded="false" | ||
| id="user-actions"> | ||
| {% if not is_guest %} | ||
| <div class="userindicator__btn-img" | ||
| style="background-image: {% if request.user.avatar %} url({{ request.user.avatar|thumbnail_url:'avatar' }}) {% else %} url({{ request.user.avatar_fallback }}) {% endif %}"> | ||
| </div> | ||
| {% endif %} | ||
| <div class="userindicator__btn-text text-start"> | ||
| <span class="userindicator__hello">{% translate "Hello" %}, </span> | ||
| {% if not is_guest %} | ||
| <br> | ||
| <div class="u-overflow-ellipsis">{{ request.user.username }}</div> | ||
| {% else %} | ||
| <span>{% translate "Guest" %}</span> | ||
| {% endif %} | ||
| </div> | ||
| <i class="fa fa-chevron-down" aria-hidden="true"></i> | ||
| </button> | ||
| <div class="dropdown-menu dropdown-menu-end userindicator__dropdown-menu" | ||
| aria-labelledby="user-actions user-actions-mobile"> | ||
| {% if request.user.is_superuser %} | ||
| <a class="dropdown-item" href="{% url 'admin:index' %}">{% translate "Admin" %}</a> | ||
| {% endif %} | ||
| {% if not is_guest %} | ||
| <a class="dropdown-item" href="{% url 'userdashboard-overview' %}">{% translate 'My Overview' %}</a> | ||
| <a class="dropdown-item" href="{% url 'account' %}">{% translate "Account Settings" %}</a> | ||
| {% for organisation in request.user.organisations %} | ||
| <a class="dropdown-item" | ||
| href="{% url 'a4dashboard:project-list' organisation_slug=organisation.slug %}"> | ||
| {{ organisation.name }} | ||
| </a> | ||
| {% endfor %} | ||
| {% settings_value "APLUS_MANUAL_URL" as manual_url %} | ||
| {% if manual_url %} | ||
| <a class="dropdown-item" | ||
| href="{{ manual_url }}/{{ LANGUAGE_CODE }}:start" | ||
| target="_blank">{% translate 'Help' %}</a> | ||
| {% endif %} | ||
| {% else %} | ||
| <a class="dropdown-item" href="https://manual.adhocracy.plus/de:start" target="_blank">{% translate "Help" %}</a> | ||
| {% endif %} | ||
| <form class="form--inline" | ||
| action="{% url 'account_logout' %}" | ||
| method="post" | ||
| aria-label="{% translate 'Logout' %}"> | ||
| {% csrf_token %} | ||
| <input type="hidden" name="next" value="{{ redirect_field_value }}"> | ||
| <button type="submit" class="dropdown-item">{% translate "Logout" %}</button> | ||
| </form> | ||
| </div> | ||
| <div class="userindicator__btn-text text-start"> | ||
| <span class="userindicator__hello">{% translate "Hello" %}</span> | ||
| <br> | ||
| <div class="u-overflow-ellipsis">{{ request.user.username }}</div> | ||
| {% endwith %} | ||
| {% else %} | ||
| <div class="btn btn--secondary-filled btn--huge btn--attached-top"> | ||
| <span class="navi__item"><a href="{% url 'account_login' %}?next={{ redirect_field_value }}">{% translate "Login" %}</a></span> | ||
| <span class="d-none d-md-inline">/</span> | ||
| <span class="navi__item"><a href="{% url 'account_signup' %}?next={{ redirect_field_value }}">{% translate "Register" %}</a></span> | ||
| </div> | ||
| <i class="fa fa-chevron-down" aria-hidden="true"></i> | ||
| </button> | ||
| <div class="dropdown-menu dropdown-menu-end userindicator__dropdown-menu" | ||
| aria-labelledby="user-actions user-actions-mobile"> | ||
| {% if request.user.is_superuser %} | ||
| <a class="dropdown-item" href="{% url 'admin:index' %}">{% translate "Admin" %}</a> | ||
| {% endif %} | ||
| <a class="dropdown-item" href="{% url 'userdashboard-overview' %}">{% translate 'My Overview' %}</a> | ||
| <a class="dropdown-item" href="{% url 'account' %}">{% translate "Account Settings" %}</a> | ||
| {% for organisation in request.user.organisations %} | ||
| <a class="dropdown-item" | ||
| href="{% url 'a4dashboard:project-list' organisation_slug=organisation.slug %}"> | ||
| {{ organisation.name }} | ||
| </a> | ||
| {% endfor %} | ||
| {% settings_value "APLUS_MANUAL_URL" as manual_url %} | ||
| {% if manual_url %} | ||
| <a class="dropdown-item" | ||
| href="{{ manual_url }}/{{ LANGUAGE_CODE }}:start" | ||
| target="_blank">{% translate 'Help' %}</a> | ||
| {% endif %} | ||
| <form class="form--inline" | ||
| action="{% url 'account_logout' %}" | ||
| method="post" | ||
| aria-label="{% translate 'Logout' %}"> | ||
| {% csrf_token %} | ||
| <input type="hidden" name="next" value="{{ redirect_field_value }}"> | ||
| <button type="submit" class="dropdown-item">{% translate "Logout" %}</button> | ||
| </form> | ||
| </div> | ||
| {% else %} | ||
| <div class="btn btn--secondary-filled btn--huge btn--attached-top"> | ||
| <span class="navi__item"><a href="{% url 'account_login' %}?next={{ redirect_field_value }}">{% translate "Login" %}</a></span> | ||
| <span class="d-none d-md-inline">/</span> | ||
| <span class="navi__item"><a href="{% url 'account_signup' %}?next={{ redirect_field_value }}">{% translate "Register" %}</a></span> | ||
| </div> | ||
| </div> | ||
| {% endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ### Added | ||
|
|
||
| - unauthenticated users can add comments and ratings and a guest user will be created for them | ||
| - deps: django-guest-user (liqd fork) | ||
|
|
||
| ### Changed | ||
|
|
||
| - deps: a4 branch-off for AR comment labeling |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,8 @@ | ||
| ### Added | ||
| - New Api Endpoint for the ARC Part of this Project | ||
| - Passing Variant Content Type to ARC App | ||
| - Adding propertys to Variant so it works with Comments and Ratings | ||
|
|
||
| ### Changed | ||
| - Comments and Variants on Desktop are bound to Variant instead of Topics | ||
|
|
||
| ### Added | ||
| - Passing Variant Content Type to ARC App | ||
|
|
||
| ### Added | ||
| - Adding propertys to Variant so it works with Comments and Ratings | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shn-liqd This is from one of your changes but I thought it already went to main, does it look alright to you if this is merged as part of my PR or does it suggest something went wrong in git?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the ContentType stuff is from @glanzel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glanzel with the more simplified API now, do we still need the scenes related name?