-
-
Notifications
You must be signed in to change notification settings - Fork 302
Robust solution for filtering unpublishable changes on frontend #5844
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,7 +175,12 @@ function handleMaxRevs(response, userId) { | |
| maxRevs[`${MAX_REV_KEY}.${channelId}`] = channelChanges[0].server_rev; | ||
| const lastChannelEditIndex = findLastIndex( | ||
| channelChanges, | ||
| c => !c.errors && !c.user_id && c.created_by_id && c.type !== CHANGE_TYPES.PUBLISHED, | ||
| c => | ||
| !c.errors && | ||
| !c.user_id && | ||
| c.created_by_id && | ||
| c.type !== CHANGE_TYPES.PUBLISHED && | ||
| !c.unpublishable, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: The // response contains only an unpublishable change → unpublished_changes should NOT be set...would lock in the fix and catch any future regression. Not strictly blocking for a P0 hotfix, but worth tracking. |
||
| ); | ||
| const lastPublishIndex = findLastIndex( | ||
| channelChanges, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -320,6 +320,7 @@ def _add_to_community_library(self, submission): | |
| categories=submission.categories, | ||
| country_codes=country_codes, | ||
| ), | ||
| created_by_id=submission.resolved_by_id, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: The existing change = Change.objects.get(
channel=self.submission.channel,
change_type=ADDED_TO_COMMUNITY_LIBRARY,
)
self.assertEqual(change.created_by_id, self.admin_user.id)
self.assertTrue(change.unpublishable)This guards against the specific regression being fixed. |
||
| # This change is not publishable and should not trigger publish-related logic | ||
| unpublishable=True, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: Clear, self-documenting comment on why |
||
| ) | ||
|
|
||
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 mean.. I guess it would make sense for "PUBLISHED" to just be an unpublishable_change!