forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Closes #2509: New notifications UI #2530
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
46d2214
Closes #2509: New notifications UI
diasf 5f1f790
Notification deletion
diasf b6bd586
add db based filtering
diasf 43a3082
cosmetic
diasf b09a699
Merge branch 'develop' into fdias-2509-notification-ui
diasf e82d812
pl translation
diasf 73bbf27
Merge branch 'develop' into fdias-2509-notification-ui
diasf 8a9b1ad
Merge branch 'develop' into fdias-2509-notification-ui
diasf da7b9ef
Merge branch 'develop' into fdias-2509-notification-ui
diasf 4ab2352
review comments
diasf 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 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
77 changes: 77 additions & 0 deletions
77
...stence/src/main/java/edu/harvard/iq/dataverse/persistence/user/UserNotificationQuery.java
This file contains 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,77 @@ | ||
package edu.harvard.iq.dataverse.persistence.user; | ||
|
||
/** | ||
* Query parameters used for user notifications. | ||
*/ | ||
public class UserNotificationQuery { | ||
|
||
private final static int DEFAULT_RESULT_LIMIT = 10; | ||
|
||
private Long userId; | ||
|
||
private String searchLabel; | ||
|
||
private int offset; | ||
|
||
private int resultLimit = DEFAULT_RESULT_LIMIT; | ||
|
||
private boolean ascending; | ||
|
||
// -------------------- CONSTRUCTORS -------------------- | ||
|
||
private UserNotificationQuery() { | ||
} | ||
|
||
// -------------------- GETTERS -------------------- | ||
|
||
public Long getUserId() { | ||
return userId; | ||
} | ||
|
||
public String getSearchLabel() { | ||
return searchLabel; | ||
} | ||
|
||
public int getOffset() { | ||
return offset; | ||
} | ||
|
||
public int getResultLimit() { | ||
return resultLimit; | ||
} | ||
|
||
public boolean isAscending() { | ||
return ascending; | ||
} | ||
|
||
// -------------------- LOGIC -------------------- | ||
|
||
static public UserNotificationQuery newQuery() { | ||
return new UserNotificationQuery(); | ||
} | ||
|
||
public UserNotificationQuery withUserId(Long userId) { | ||
this.userId = userId; | ||
return this; | ||
} | ||
|
||
public UserNotificationQuery withSearchLabel(String searchLabel) { | ||
this.searchLabel = searchLabel; | ||
return this; | ||
} | ||
|
||
public UserNotificationQuery withOffset(int offset) { | ||
this.offset = offset; | ||
return this; | ||
} | ||
|
||
public UserNotificationQuery withResultLimit(int resultLimit) { | ||
this.resultLimit = resultLimit; | ||
return this; | ||
} | ||
|
||
public UserNotificationQuery withAscending(boolean ascending) { | ||
this.ascending = ascending; | ||
return this; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
.../src/main/java/edu/harvard/iq/dataverse/persistence/user/UserNotificationQueryResult.java
This file contains 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,30 @@ | ||
package edu.harvard.iq.dataverse.persistence.user; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Query result including the total count of available results. | ||
*/ | ||
public class UserNotificationQueryResult { | ||
|
||
private final List<UserNotification> result; | ||
|
||
private final Long totalCount; | ||
|
||
// -------------------- CONSTRUCTORS -------------------- | ||
|
||
public UserNotificationQueryResult(List<UserNotification> result, Long totalCount) { | ||
this.result = result; | ||
this.totalCount = totalCount; | ||
} | ||
|
||
// -------------------- GETTERS -------------------- | ||
|
||
public List<UserNotification> getResult() { | ||
return result; | ||
} | ||
|
||
public Long getTotalCount() { | ||
return totalCount; | ||
} | ||
} |
This file contains 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 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 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
3 changes: 3 additions & 0 deletions
3
dataverse-persistence/src/main/resources/db/migration/V77__notificationSearchLabel.sql
This file contains 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,3 @@ | ||
ALTER TABLE usernotification ADD COLUMN searchLabel TEXT; | ||
|
||
CREATE INDEX index_usernotification_searchLabel on usernotification (searchLabel); |
This file contains 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 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 |
---|---|---|
|
@@ -366,14 +366,14 @@ VALUES ('{"email": "[email protected]"}', 'SEND_NEWSLETTER_EMAIL', 1); | |
|
||
-------------------- USER NOTIFICATIONS --------------------- | ||
|
||
INSERT INTO usernotification(id, user_id, type, objectid, emailed, readnotification, senddate) | ||
VALUES (1, 2, 'CREATEACC', NULL, true, true, '2020-09-24 13:01:00'); | ||
INSERT INTO usernotification(id, user_id, type, objectid, emailed, readnotification, senddate) | ||
VALUES (2, 2, 'CREATEDV', 19, false, true, '2020-09-25 14:00:00'); | ||
INSERT INTO usernotification(id, user_id, type, objectid, emailed, readnotification, senddate, parameters) | ||
VALUES (3, 2, 'SUBMITTEDDS', 44, false, false, '2020-09-26 10:00:00', '{"message":"message to curator", "requestorId":"4"}'); | ||
INSERT INTO usernotification(id, user_id, type, objectid, emailed, readnotification, senddate, parameters) | ||
VALUES (4, 4, 'RETURNEDDS', 44, false, false, '2020-09-26 10:10:00', '{"message":"send back to author", "requestorId":"2"}'); | ||
INSERT INTO usernotification(id, user_id, type, objectid, emailed, readnotification, senddate, searchlabel) | ||
VALUES (1, 2, 'CREATEACC', NULL, true, true, '2020-09-24 13:01:00', '[email protected]'); | ||
INSERT INTO usernotification(id, user_id, type, objectid, emailed, readnotification, senddate, searchlabel) | ||
VALUES (2, 2, 'CREATEDV', 19, false, true, '2020-09-25 14:00:00', 'datauniverse'); | ||
INSERT INTO usernotification(id, user_id, type, objectid, emailed, readnotification, senddate, parameters, searchlabel) | ||
VALUES (3, 2, 'SUBMITTEDDS', 44, false, false, '2020-09-26 10:00:00', '{"message":"message to curator", "requestorId":"4"}', 'monkeys dataset'); | ||
INSERT INTO usernotification(id, user_id, type, objectid, emailed, readnotification, senddate, parameters, searchlabel) | ||
VALUES (4, 4, 'RETURNEDDS', 44, false, false, '2020-09-26 10:10:00', '{"message":"send back to author", "requestorId":"2"}', 'monkeys dataset'); | ||
INSERT INTO usernotification(id, user_id, type, objectid, emailed, readnotification, senddate, parameters) | ||
VALUES (5, 4, 'RETURNEDDS', 44, false, false, '2020-09-26 10:10:00', '{"message":"send back to author", "requestorId":"3"}'); | ||
-------------------- SUGGESTIONS --------------------- | ||
|
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.
If we are making this a
builder
kind of class then I think that we should block creating the object outside of it by adding private constructor.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.
Yeah, good point, added private constructor.