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

Allow reporting a user profile everywhere in the app #3085

Merged
merged 1 commit into from
Jan 6, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ public void onActivate() {
profileCardReputationController.updateUserProfileData(userProfile);
profileCardOffersController.updateUserProfileData(userProfile);
boolean isMyProfile = userIdentityService.isUserIdentityPresent(userProfile.getId());
model.getShouldShowReportButton().set(!isMyProfile && selectedChannel.isPresent());
model.getShouldShowUserActionsMenu().set(!isMyProfile);
model.getOffersTabButtonText().set(Res.get("user.profileCard.tab.offers",
profileCardOffersController.getNumberOffers()).toUpperCase());
Expand Down Expand Up @@ -168,13 +167,19 @@ void onToggleIgnoreUser() {
}

void onReportUser() {
// Chat channel domain is a required field in the protobuf ReportToModeratorMessage.
ChatChannelDomain chatChannelDomain;
if (selectedChannel.isPresent()) {
ChatChannelDomain chatChannelDomain = selectedChannel.get().getChatChannelDomain();
OverlayController.hide(() -> {
Navigation.navigateTo(NavigationTarget.REPORT_TO_MODERATOR,
new ReportToModeratorWindow.InitData(model.getUserProfile().get(), chatChannelDomain));
});
// If the user profile is reported from a chat, then we use the domain of that chat.
chatChannelDomain = selectedChannel.get().getChatChannelDomain();
} else {
// Otherwise we use Support as the default domain to ensure backwards compatibility.
chatChannelDomain = ChatChannelDomain.SUPPORT;
}

OverlayController.hide(() ->
Navigation.navigateTo(NavigationTarget.REPORT_TO_MODERATOR,
new ReportToModeratorWindow.InitData(model.getUserProfile().get(), chatChannelDomain)));
}

void onClose() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class ProfileCardModel extends TabModel {
private final ObjectProperty<UserProfile> userProfile = new SimpleObjectProperty<>();
private final ObjectProperty<ReputationScore> reputationScore = new SimpleObjectProperty<>();
private final BooleanProperty ignoreUserSelected = new SimpleBooleanProperty();
private final BooleanProperty shouldShowReportButton = new SimpleBooleanProperty();
private final BooleanProperty shouldShowUserActionsMenu = new SimpleBooleanProperty();
private final StringProperty offersTabButtonText = new SimpleStringProperty();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ protected void onViewAttached() {
ignore.managedProperty().bind(model.getIgnoreUserSelected().not().and(model.getShouldShowUserActionsMenu()));
undoIgnore.visibleProperty().bind(model.getIgnoreUserSelected().and(model.getShouldShowUserActionsMenu()));
undoIgnore.managedProperty().bind(model.getIgnoreUserSelected().and(model.getShouldShowUserActionsMenu()));
report.visibleProperty().bind(model.getShouldShowReportButton());
report.managedProperty().bind(model.getShouldShowReportButton());
userActionsBox.visibleProperty().bind(model.getShouldShowUserActionsMenu());
userActionsBox.managedProperty().bind(model.getShouldShowUserActionsMenu());
offersTabButton.getLabel().textProperty().bind(model.getOffersTabButtonText());
Expand Down Expand Up @@ -102,8 +100,6 @@ protected void onViewDetached() {
ignore.managedProperty().unbind();
undoIgnore.visibleProperty().unbind();
undoIgnore.managedProperty().unbind();
report.visibleProperty().unbind();
report.managedProperty().unbind();
userActionsBox.visibleProperty().unbind();
userActionsBox.managedProperty().unbind();
offersTabButton.getLabel().textProperty().unbind();
Expand Down
Loading