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

feat(community): send signals about member reevaluation in progress #5120

Merged
merged 1 commit into from
May 8, 2024

Conversation

jrainville
Copy link
Member

Needed for status-im/status-desktop#14378

Sends signals when the member re-evaluation is ongoing

@status-im-auto
Copy link
Member

status-im-auto commented May 6, 2024

Jenkins Builds

Click to see older builds (4)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 9623775 #1 2024-05-06 21:15:12 ~1 min tests 📄log
✔️ 9623775 #1 2024-05-06 21:17:59 ~4 min linux 📦zip
✔️ 9623775 #1 2024-05-06 21:19:02 ~5 min ios 📦zip
✔️ 9623775 #1 2024-05-06 21:19:41 ~5 min android 📦aar
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 16655f7 #2 2024-05-07 18:50:47 ~2 min linux 📦zip
✔️ 16655f7 #2 2024-05-07 18:51:39 ~3 min ios 📦zip
✔️ 16655f7 #2 2024-05-07 18:53:46 ~5 min android 📦aar
✔️ 16655f7 #2 2024-05-07 19:30:26 ~42 min tests 📄log
✔️ f2ad9ac #3 2024-05-08 18:47:46 ~2 min android 📦aar
✔️ f2ad9ac #3 2024-05-08 18:47:52 ~2 min linux 📦zip
✔️ f2ad9ac #3 2024-05-08 18:48:37 ~3 min ios 📦zip
✔️ f2ad9ac #3 2024-05-08 19:28:03 ~42 min tests 📄log

Comment on lines 1224 to 1238
// Publish when the reevluation started since it can take a while
signal.SendCommunityMemberReevaluationStarted(community.IDString())

newPrivilegedMembers, err := m.ReevaluateMembers(community)

// Publish the reevaluation ending, even if it errored
// A possible improvement would be to pass the error here
signal.SendCommunityMemberReevaluationEnded(community.IDString())

Copy link
Collaborator

Choose a reason for hiding this comment

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

I thin it would be better to keep it inside ReevaluateMembers maybe? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

It's simpler to put it in reevaluateCommunityMembersPermissions, because it's the one that gets called by others and the only one that calls ReevaluateMembers.

Also, I want to call SendCommunityMemberReevaluationEnded whether it is a failure or not, and doing that in ReevaluateMembers would be a pain, because I'd have to put it before every returns

Comment on lines 3 to 18
const (
MemberReevaluationStarted = "community.memberReevaluationStarted"
MemberReevaluationEnded = "community.memberReevaluationEnded"
)

type CommunityMemberReevaluationSignal struct {
CommunityID string `json:"communityId"`
}
Copy link
Contributor

Choose a reason for hiding this comment

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

what if instead MemberReevaluationStarted and MemberReevaluationEnded we will register MemberReevaluationStatus and return CommunityMemberReevaluationSignal with the status (enum: none, started/inProgress, finished)? In this case, on the NIM side, you can decrease the amount of the code too, because you'll not need to do separate methods for handling started/ended

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

@jrainville jrainville force-pushed the feat/inform-owner-when-evaluation-is-active branch from 9623775 to 16655f7 Compare May 7, 2024 18:47
@jrainville jrainville force-pushed the feat/inform-owner-when-evaluation-is-active branch from 16655f7 to f2ad9ac Compare May 8, 2024 18:44
@jrainville jrainville merged commit 5f4aab3 into develop May 8, 2024
7 checks passed
@jrainville jrainville deleted the feat/inform-owner-when-evaluation-is-active branch May 8, 2024 19:55
@@ -1227,7 +1227,15 @@ func (m *Manager) DeleteCommunityTokenPermission(request *requests.DeleteCommuni
}

func (m *Manager) reevaluateCommunityMembersPermissions(communityID types.HexBytes) error {
// Publish when the reevluation started since it can take a while
signal.SendCommunityMemberReevaluationStarted(types.EncodeHex(communityID))
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be great if we could use MessengerSignalsHandler instead. Globals are bad 👮

Example:

if m.config.messengerSignalsHandler != nil {
	m.config.messengerSignalsHandler.MessengerResponse(response)
}

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.

None yet

6 participants