-
Notifications
You must be signed in to change notification settings - Fork 1
Ja vr private descriptions #131
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
Open
vrautela
wants to merge
10
commits into
master
Choose a base branch
from
JA-VR-private-descriptions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a3a8558
started backend changes for priv descriptions
ja0911 f554185
isolated problem
ja0911 7479102
Resolved private description bug
ja0911 bdbe303
Merge branch 'master' into JA-VR-private-descriptions
vrautela 7a4799d
rename db migration to version 18
vrautela e650f75
fixed 2/3 pr fixes
ja0911 3ecf785
fix failing testGetSingleEvent2 and testModifyEvent2 tests by adding …
vrautela 7ad6058
fix failing modify event tests by adding mock return statements
vrautela c7121fa
Merge branch 'master' into JA-VR-private-descriptions
ja0911 87c91a0
it works
rymaju 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
2 changes: 2 additions & 0 deletions
2
persist/src/main/resources/db/migration/V18__AddEventPrivateDescription.sql
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,2 @@ | ||
| ALTER TABLE events | ||
| ADD COLUMN private_description TEXT DEFAULT NULL; |
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 |
|---|---|---|
|
|
@@ -81,6 +81,35 @@ public SingleEventResponse getSingleEvent(int eventId, JWTData userData) { | |
| throw new EventDoesNotExistException(eventId); | ||
| } | ||
|
|
||
| // getting all of the users registered for this event | ||
| // TODO: is it bad that we're pretending to be an admin in this method call? | ||
| EventRegistrations registrations = this.getEventRegisteredUsers(eventId, new JWTData(0, PrivilegeLevel.ADMIN)); | ||
| boolean userRegisteredForEvent = false; | ||
| for (Registration reg : registrations.getRegistrations()) { | ||
| if (reg.getUserId() == userData.getUserId()) { | ||
| userRegisteredForEvent = true; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| // hide the private description if the user isn't registered and they're not an admin | ||
| if (!userRegisteredForEvent && userData.getPrivilegeLevel() != PrivilegeLevel.ADMIN) { | ||
|
||
| event.setPrivateDescription(null); | ||
ja0911 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| // GetEventsResponse res = this.getEventsSignedUp(new GetUserEventsRequest(), userData); | ||
| // boolean userRegisteredForEvent = false; | ||
| // for (SingleEventResponse registeredEvent : res.getEvents()) { | ||
| // if (registeredEvent.getId() == eventId) { | ||
| // userRegisteredForEvent = true; | ||
| // break; | ||
| // } | ||
| // } | ||
| // | ||
| // if (!userRegisteredForEvent) { | ||
| // event.setPrivateDescription(null); | ||
| // } | ||
|
|
||
| return eventPojoToResponse(event, userData); | ||
| } | ||
|
|
||
|
|
@@ -188,6 +217,9 @@ public SingleEventResponse modifyEvent( | |
| if (details.getDescription() != null) { | ||
| record.setDescription(details.getDescription()); | ||
| } | ||
| if (details.getPrivateDescription() != null) { | ||
| record.setPrivateDescription(details.getPrivateDescription()); | ||
ja0911 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| if (details.getLocation() != null) { | ||
| record.setLocation(details.getLocation()); | ||
| } | ||
|
|
@@ -347,6 +379,7 @@ private List<SingleEventResponse> listOfEventsToListOfSingleEventResponse( | |
| EventDetails details = | ||
| new EventDetails( | ||
| event.getDescription(), | ||
| event.getPrivateDescription(), | ||
ja0911 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| event.getLocation(), | ||
| event.getStartTime(), | ||
| event.getEndTime()); | ||
|
|
@@ -371,7 +404,11 @@ private SingleEventResponse eventPojoToResponse(Events event, JWTData userData) | |
|
|
||
| EventDetails details = | ||
| new EventDetails( | ||
| event.getDescription(), event.getLocation(), event.getStartTime(), event.getEndTime()); | ||
| event.getDescription(), | ||
| event.getPrivateDescription(), | ||
ja0911 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| event.getLocation(), | ||
| event.getStartTime(), | ||
| event.getEndTime()); | ||
| return new SingleEventResponse( | ||
| event.getId(), | ||
| event.getTitle(), | ||
|
|
@@ -389,6 +426,7 @@ private EventsRecord eventRequestToRecord(CreateEventRequest request) { | |
| EventsRecord newRecord = db.newRecord(EVENTS); | ||
| newRecord.setTitle(request.getTitle()); | ||
| newRecord.setDescription(request.getDetails().getDescription()); | ||
| newRecord.setPrivateDescription(request.getDetails().getPrivateDescription()); | ||
| newRecord.setThumbnail(request.getThumbnail()); | ||
| newRecord.setCapacity(request.getCapacity()); | ||
| newRecord.setLocation(request.getDetails().getLocation()); | ||
|
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.