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

fix: Approval header now not displayed for already approved entities #1108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions civictechprojects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ def _hydrate_to_json(self):
'group_short_description': self.group_short_description,
'group_project_count': projects.count(),
'group_slug': self.group_slug,
'is_private': self.is_private
'is_private': self.is_private,
'group_approved': self.is_searchable
}

if len(projects) > 0:
Expand Down Expand Up @@ -499,7 +500,8 @@ def _hydrate_to_json(self):
'event_slug': self.event_slug,
'is_private': self.is_private,
'show_headers': self.show_headers,
"is_activated": self.is_activated
"is_activated": self.is_activated,
'event_approved': self.is_searchable
}

if event_room is not None:
Expand Down
14 changes: 10 additions & 4 deletions common/components/controllers/CreateEventController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,16 @@ class CreateEventController extends React.PureComponent<{||}, State> {
}

onFinalSubmitSuccess(event: EventData): void {
window.location.href = url.section(Section.AboutEvent, {
id: event.event_id,
eventAwaitingApproval: url.encodeNameForUrlPassing(event.event_name),
});

if(!event.event_approved){
window.location.href = url.section(Section.AboutEvent, {
id: event.event_id,
eventAwaitingApproval: url.encodeNameForUrlPassing(event.event_name),
});
} else {
window.location.href = url.section(Section.AboutEvent, null);
}

}

render(): React$Node {
Expand Down
11 changes: 8 additions & 3 deletions common/components/controllers/CreateGroupController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,14 @@ class CreateGroupController extends React.PureComponent<{||}, State> {
onFinalSubmitSuccess(group: GroupDetailsAPIData): void {
// metrics.logGroupCreated(CurrentUser.userID());
// TODO: Fix bug with switching to this section without page reload
window.location.href = url.section(Section.MyGroups, {
groupAwaitingApproval: url.encodeNameForUrlPassing(group.group_name),
});
if(!group.group_approved){
window.location.href = url.section(Section.MyGroups, {
groupAwaitingApproval: url.encodeNameForUrlPassing(group.group_name),
});
} else{
window.location.href = url.section(Section.MyGroups, null);
}

}

render(): React$Node {
Expand Down
8 changes: 7 additions & 1 deletion common/components/controllers/CreateProjectController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,13 @@ class CreateProjectController extends React.PureComponent<{||}, State> {
fromEventId: project.event_created_from,
});
}
window.location.href = url.section(Section.MyProjects, urlArgs);
if(!project.project_approved){
window.location.href = url.section(Section.MyProjects, urlArgs);
} else {
window.location.href = url.section(Section.MyProjects, null);

}

}

render(): React$Node {
Expand Down
1 change: 1 addition & 0 deletions common/components/utils/EventAPIUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export type EventData = {|
event_conference_admin_url: ?string,
event_conference_participants: ?string,
event_time_zones: $ReadOnlyArray<LocationTimezone>,
event_approved: boolean,
|};

export type EventTileAPIData = {|
Expand Down
1 change: 1 addition & 0 deletions common/components/utils/GroupAPIUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export type GroupDetailsAPIData = {|
group_links: $ReadOnlyArray<LinkInfo>,
group_files: $ReadOnlyArray<FileInfo>,
is_private: boolean,
group_approved: boolean,
|} & GroupTileAPIData;

export type ProjectRelationshipAPIData = {|
Expand Down