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

Collapse favorite/boost notifications into a single notification #38

Merged
merged 11 commits into from
Feb 4, 2023

Conversation

deanveloper
Copy link
Collaborator

@deanveloper deanveloper commented Jan 29, 2023

resolves #33

Summary of changes:

  • name_list
    • New component, represents a localized list of names.
  • status
    • Changed account prop (the prop indicating a "related" account, such as who favorited a post inside of a notification) to optionally be a list of accounts
  • status_header
    • The "status header" is the profile picture.
    • Changed friend prop to friends to prepare for being able to show multiple profile pictures for the multiple accounts that favorited the post.
    • (While the propname changed, I haven't implemented the feature yet)
  • status_prepend
    • The "status prepend" is a component which prepends a status, usually used for notifications, says things like "x favorited your post"
  • status_container
    • swapped priority of account vs props.account... might need to check for regressions here but I haven't found any so far.
  • notification_container
    • just switched to new property name accountIds
  • notifications/index.js
    • bulk of the actual logic, groups notifications together and turns the account prop into an account list
  • selectors/index.js
    • expect a list of accounts instead of a single account

@github-actions
Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

@deanveloper deanveloper changed the title Feat/33 combine notifs draft - feat/33 combine notifs Jan 29, 2023
@deanveloper deanveloper marked this pull request as draft January 29, 2023 09:41
@deanveloper deanveloper changed the title draft - feat/33 combine notifs feat/33 combine notifs Jan 29, 2023
@deanveloper
Copy link
Collaborator Author

earlier there were issues regarding some other components which expected account to be a single account instead of an array, for now I've made it so that notification.account is just a single acount when possible, the only way for it to be an array is for favorite/reblog notifications

@deanveloper deanveloper changed the title feat/33 combine notifs Collapse favorite/boost notifications into a single notification Jan 30, 2023
@deanveloper deanveloper marked this pull request as ready for review January 30, 2023 01:17
@deanveloper
Copy link
Collaborator Author

deanveloper commented Jan 30, 2023

Should be ready to go! We can add more things to group by later as well. For now I just have boosts and favorites.

image

edit - "4" is one of the names of my test accounts, that's not a bug 😅

if (Intl.ListFormat) {
rebloggedByText = intl.formatMessage(
{ id: 'status.reblogged_by', defaultMessage: '{name} boosted' },
{ name: new Intl.ListFormat(intl.locale, { type: 'conjunction' }).format(accounts.map(acct => acct.get('acct'))) },
Copy link
Owner

@neatchee neatchee Feb 4, 2023

Choose a reason for hiding this comment

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

Is this unsorted?
We should make sure we're always showing the most recent accounts to have boosted/favorited the status

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It should be sorted by recent-first since that's the order the grouping function puts them in, I'll check again when I add reactions

render () {
const { intl, notifications, isLoading, isUnread, columnId, multiColumn, hasMore, numPending, showFilterBar, lastReadId, canMarkAsRead, needsNotificationPermission } = this.props;
Copy link
Owner

@neatchee neatchee Feb 4, 2023

Choose a reason for hiding this comment

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

Is there a reason "notifications" was removed? IDE cleaned it up I'm guessing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I instead decided to calculate the notifications variable based on user settings instead of coming directly from props (see line 268).

Might clean the up the code down there since it looks a bit more confusing than I'd like.

@neatchee neatchee merged commit 612592f into main Feb 4, 2023
@neatchee neatchee deleted the feat/33-combine-notifs branch February 4, 2023 02:31
@neatchee neatchee restored the feat/33-combine-notifs branch February 15, 2023 00:10
@neatchee neatchee deleted the feat/33-combine-notifs branch February 15, 2023 00:34
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.

[frontend-only] Option to combine similar notifications into a single notification
2 participants