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

Create moderation request on publish #1413

Conversation

alejandromumo
Copy link
Member

@alejandromumo alejandromumo commented Aug 14, 2023

@alejandromumo alejandromumo marked this pull request as draft August 14, 2023 15:44
@alejandromumo alejandromumo force-pushed the create_moderation_request_on_publish branch 4 times, most recently from d963a24 to 9f2c5cb Compare August 16, 2023 11:30
@alejandromumo alejandromumo marked this pull request as ready for review August 16, 2023 11:30

# Users are verified by default. This will disable the automatic creation of moderation requests after publishing a record.
# When testing unverified users, there is a "unverified_user" fixture for that purpose.
app_config["ACCOUNTS_DEFAULT_VERIFIED_STATUS"] = True
Copy link
Member Author

@alejandromumo alejandromumo Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This simplifies testing.

That way, after publish there are no moderation requests created in tests and it's easier to test user moderation (I created explicit users for that purpose).

is_verified = record.parent.is_verified

# Owner might not resolve to a User (e.g. when the record was created by system)
owner_exists = record.parent.access.owner.owner_id
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to identify if it's the system.

@alejandromumo alejandromumo force-pushed the create_moderation_request_on_publish branch 2 times, most recently from b335389 to 5306807 Compare August 18, 2023 13:09
records_service.update_draft(
unverified_user.identity, new_version.id, minimal_record
)
# Since tasks are executed synchronously in tests, the db session that is rolledback inside the session
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rephrase a bit to depict what is wrong?

@@ -47,11 +69,17 @@ def test_user_moderation_approve(

assert is_verified == False

moderation_request = mod_request_create(uploader.id)
# Approve the user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outdated?

@alejandromumo alejandromumo force-pushed the create_moderation_request_on_publish branch from 5306807 to 42f8967 Compare August 18, 2023 13:27
@zzacharo zzacharo force-pushed the create_moderation_request_on_publish branch 2 times, most recently from 6957ab3 to 32c273f Compare August 22, 2023 08:18
@zzacharo zzacharo force-pushed the create_moderation_request_on_publish branch from 32c273f to 905230d Compare August 22, 2023 20:55
@zzacharo zzacharo merged commit 30fd56a into inveniosoftware:master Aug 22, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[USER MODERATION] - 5th deliverable - create moderation request on first publish
2 participants