Skip to content

Commit

Permalink
(settings): removed community permissions,tokens,airdrop and discord …
Browse files Browse the repository at this point in the history
…options

Also:
test(suite_communities): Fixed community related tests

- A new intermediate popup is now displayed when user clicks on `Create New Community` button from `Community Portal`.
- Reformulated `tst_communityPermissions` since now it is a default option without the need of activating it from experimental feature's section.

Closes #10115
  • Loading branch information
alexandraB99 committed Apr 28, 2023
1 parent 28374eb commit 5615a53
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 125 deletions.
38 changes: 0 additions & 38 deletions src/app/global/local_account_sensitive_settings.nim
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ const LSS_KEY_STICKERS_ENS_ROPSTEN* = "stickersEnsRopsten"
const DEFAULT_STICKERS_ENS_ROPSTEN = false
const LSS_KEY_USER_DECLINED_BACKUP_BANNER* = "userDeclinedBackupBanner"
const DEFAULT_USER_DECLINED_BACKUP_BANNER = false
const LSS_KEY_IS_DISCORD_IMPORT_TOOL_ENABLED* = "isDiscordImportToolEnabled"
const DEFAULT_IS_DISCORD_IMPORT_TOOL_ENABLED = false


Expand Down Expand Up @@ -227,30 +226,6 @@ QtObject:
write = setProfileSplitView
notify = profileSplitViewChanged

proc isCommunityPermissionsEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getIsCommunityPermissionsEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_IS_COMMUNITY_PERMISSIONS_ENABLED, newQVariant(DEFAULT_IS_COMMUNITY_PERMISSIONS_ENABLED))
proc setIsCommunityPermissionsEnabled*(self: LocalAccountSensitiveSettings, value: bool) {.slot.} =
setSettingsProp(self, LSS_KEY_IS_COMMUNITY_PERMISSIONS_ENABLED, newQVariant(value)):
self.isCommunityPermissionsEnabledChanged()

QtProperty[bool] isCommunityPermissionsEnabled:
read = getIsCommunityPermissionsEnabled
write = setIsCommunityPermissionsEnabled
notify = isCommunityPermissionsEnabledChanged

proc isCommunityTokensEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getIsCommunityTokensEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_IS_COMMUNITY_TOKENS_ENABLED, newQVariant(DEFAULT_IS_COMMUNITY_TOKENS_ENABLED))
proc setIsCommunityTokensEnabled*(self: LocalAccountSensitiveSettings, value: bool) {.slot.} =
setSettingsProp(self, LSS_KEY_IS_COMMUNITY_TOKENS_ENABLED, newQVariant(value)):
self.isCommunityTokensEnabledChanged()

QtProperty[bool] isCommunityTokensEnabled:
read = getIsCommunityTokensEnabled
write = setIsCommunityTokensEnabled
notify = isCommunityTokensEnabledChanged

proc nodeManagementEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getNodeManagementEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_NODE_MANAGEMENT_ENABLED, newQVariant(DEFAULT_NODE_MANAGEMENT_ENABLED))
Expand All @@ -263,18 +238,6 @@ QtObject:
write = setNodeManagementEnabled
notify = nodeManagementEnabledChanged

proc isDiscordImportToolEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getIsDiscordImportToolEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_IS_DISCORD_IMPORT_TOOL_ENABLED, newQVariant(DEFAULT_IS_DISCORD_IMPORT_TOOL_ENABLED))
proc setIsDiscordImportToolEnabled*(self: LocalAccountSensitiveSettings, value: bool) {.slot.} =
setSettingsProp(self, LSS_KEY_IS_DISCORD_IMPORT_TOOL_ENABLED, newQVariant(value)):
self.isDiscordImportToolEnabledChanged()

QtProperty[bool] isDiscordImportToolEnabled:
read = getIsDiscordImportToolEnabled
write = setIsDiscordImportToolEnabled
notify = isDiscordImportToolEnabledChanged

proc isBrowserEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getIsBrowserEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_IS_BROWSER_ENABLED, newQVariant(DEFAULT_IS_BROWSER_ENABLED))
Expand Down Expand Up @@ -774,7 +737,6 @@ QtObject:
of LSS_KEY_CHAT_SPLIT_VIEW: self.chatSplitViewChanged()
of LSS_KEY_WALLET_SPLIT_VIEW: self.walletSplitViewChanged()
of LSS_KEY_PROFILE_SPLIT_VIEW: self.profileSplitViewChanged()
of LSS_KEY_IS_COMMUNITY_PERMISSIONS_ENABLED: self.isCommunityPermissionsEnabledChanged()
of LSS_KEY_NODE_MANAGEMENT_ENABLED: self.nodeManagementEnabledChanged()
of LSS_KEY_IS_BROWSER_ENABLED: self.isBrowserEnabledChanged()
of LSS_KEY_SHOW_ONLINE_USERS: self.showOnlineUsersChanged()
Expand Down
3 changes: 3 additions & 0 deletions test/ui-test/src/drivers/SquishDriverVerification.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def verify_equals(val1, val2):
def log(text: str):
test.log(text)

def warning(text: str):
test.warning(text)


def verify_or_create_screenshot(vp: str, obj: Dict[str, Any]):
try:
Expand Down
7 changes: 3 additions & 4 deletions test/ui-test/src/screens/SettingsScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ def profile_settings(self) -> 'ProfileSettingsView':
def open_advanced_settings(self):
click_obj_by_name(SidebarComponents.ADVANCED_OPTION.value)

def activate_community_permission_settings(self):
click_obj_by_name(AdvancedOptionScreen.ACTIVATE_OR_DEACTIVATE_COMMUNITY_PERMISSIONS.value)
click_obj_by_name(AdvancedOptionScreen.I_UNDERSTAND_POP_UP.value)

def open_wallet_settings(self):
click_obj_by_name(SidebarComponents.WALLET_OPTION.value)

Expand Down Expand Up @@ -378,6 +374,9 @@ def open_community(self, community_name: str):
click_obj(delegate)
return
verify(False, "Community not found")

def toggle_experimental_feature(self, settings_type: str):
warning("TODO: Implement toggle_experimental_feature method foreach settings type")


class ProfileSettingsView(BaseElement):
Expand Down
4 changes: 3 additions & 1 deletion test/ui-test/src/screens/StatusCommunityPortalScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from drivers.SquishDriver import *
from drivers.SquishDriverVerification import *


class MainCommunityPortalScreen(Enum):
CREATE_COMMUNITY_BUTTON: str = "communitiesPortalLayoutContainer_createCommunityButton_StatusButton"
CREATE_COMMUNITY_BANNER_BUTTON: str = "createCommunity_bannerButton"


class CreateCommunityPopup(Enum):
Expand All @@ -26,6 +26,8 @@ def __init__(self):
def create_community(self, communityName: str, communityDescription: str, introMessage: str, outroMessage: str):
click_obj_by_name(MainCommunityPortalScreen.CREATE_COMMUNITY_BUTTON.value)

click_obj_by_name(MainCommunityPortalScreen.CREATE_COMMUNITY_BANNER_BUTTON.value)

type_text(CreateCommunityPopup.COMMUNITY_NAME_INPUT.value, communityName)
type_text(CreateCommunityPopup.COMMUNITY_DESCRIPTION_INPUT.value, communityDescription)
click_obj_by_name(CreateCommunityPopup.NEXT_SCREEN_BUTTON.value)
Expand Down
3 changes: 1 addition & 2 deletions test/ui-test/testSuites/global_shared/steps/settingsSteps.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def step(context: any, settings_type:str):

@Given("\"|any|\" is toggled on under Experimental features")
def step(context: any, settings_type:str):
#TODO: Implement parameters for settings
_settingsScreen.activate_community_permission_settings()
_settingsScreen.toggle_experimental_feature(settings_type)

#########################
### ACTIONS region:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
communitiesPortalLayoutContainer_createCommunityButton_StatusButton = {"container": mainWindow_communitiesPortalLayoutContainer_CommunitiesPortalLayout, "objectName": "createCommunityButton", "type": "StatusButton", "visible": True}
navBarListView_All_Community_Buttons = {"checkable": True, "container": mainWindow_communityNavBarListView_ListView, "objectName": "CommunityNavBarButton", "type": "StatusNavBarTabButton"}

# Create community intermediate popup:
createCommunity_banner = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityBanner", "type": "CommunityBanner", "visible": True}
createCommunity_bannerButton = {"container": createCommunity_banner, "objectName": "communityBannerButton", "type": "StatusButton", "visible": True}

# Create community popup:
createCommunityNameInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityNameInput", "type": "TextEdit", "visible": True}
createCommunityDescriptionInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityDescriptionInput", "type": "TextEdit", "visible": True}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ def step(context, category_name, channel_names):

@Given("\"|any|\" is toggled on under Experimental features")
def step(context: any, settings_type:str):
#TODO: Implement parameters for settings
_settingsScreen.activate_community_permission_settings()
_settingsScreen.toggle_experimental_feature(settings_type)

#########################
### ACTIONS region:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ Background:
And the user lands on the community named "Test-Community"


Scenario: Enable community permissions feature
Given the user opens app settings screen
And Application Settings "Advanced" is open
And "Community Permissions Settings" is toggled on under Experimental features
And the user opens the communities settings
Then the user opens the community named "Test-Community"
And the user lands on the community named "Test-Community"
Scenario: Community permissions is an available option is Community Settings
When "Manage Community" is clicked in the community sidebar
Then "Permissions" should be an available option in Community Settings
2 changes: 0 additions & 2 deletions ui/app/AppLayouts/Chat/stores/RootStore.qml
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ QtObject {

property var communitiesModuleInst: communitiesModule
property var communitiesList: communitiesModuleInst.model
property bool communityPermissionsEnabled: localAccountSensitiveSettings.isCommunityPermissionsEnabled
property bool communityTokensEnabled: localAccountSensitiveSettings.isCommunityTokensEnabled

property var userProfileInst: userProfile

Expand Down
6 changes: 3 additions & 3 deletions ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ StatusSectionLayout {
// TODO: get this model from backend?
property var settingsMenuModel: [{id: Constants.CommunitySettingsSections.Overview, name: qsTr("Overview"), icon: "show", enabled: true},
{id: Constants.CommunitySettingsSections.Members, name: qsTr("Members"), icon: "group-chat", enabled: true, },
{id: Constants.CommunitySettingsSections.Permissions, name: qsTr("Permissions"), icon: "objects", enabled: root.rootStore.communityPermissionsEnabled},
{id: Constants.CommunitySettingsSections.MintTokens, name: qsTr("Mint Tokens"), icon: "token", enabled: root.rootStore.communityTokensEnabled},
{id: Constants.CommunitySettingsSections.Airdrops, name: qsTr("Airdrops"), icon: "airdrop", enabled: root.rootStore.communityTokensEnabled}]
{id: Constants.CommunitySettingsSections.Permissions, name: qsTr("Permissions"), icon: "objects", enabled: true},
{id: Constants.CommunitySettingsSections.MintTokens, name: qsTr("Mint Tokens"), icon: "token", enabled: true},
{id: Constants.CommunitySettingsSections.Airdrops, name: qsTr("Airdrops"), icon: "airdrop", enabled: true}]
// TODO: Next community settings options:
// {name: qsTr("Token sales"), icon: "token-sale"},
// {name: qsTr("Subscriptions"), icon: "subscription"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ StatusSectionLayout {
verticalPadding: 0
text: qsTr("Create New Community")
onClicked: {
if (localAccountSensitiveSettings.isDiscordImportToolEnabled) {
Global.openPopup(chooseCommunityCreationTypePopupComponent)
} else {
Global.openPopup(createCommunitiesPopupComponent)
}
Global.openPopup(chooseCommunityCreationTypePopupComponent)
}
}
}
Expand Down Expand Up @@ -234,6 +230,7 @@ StatusSectionLayout {
contentItem: RowLayout {
spacing: 20
CommunityBanner {
objectName: "createCommunityBanner"
text: qsTr("Create a new Status community")
buttonText: qsTr("Create new")
icon.name: "favourite"
Expand Down
9 changes: 0 additions & 9 deletions ui/app/AppLayouts/Profile/stores/AdvancedStore.qml
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,6 @@ QtObject {
else if (feature === experimentalFeatures.gifWidget) {
localAccountSensitiveSettings.isGifWidgetEnabled = !localAccountSensitiveSettings.isGifWidgetEnabled
}
else if (feature === experimentalFeatures.communityPermissions) {
localAccountSensitiveSettings.isCommunityPermissionsEnabled = !localAccountSensitiveSettings.isCommunityPermissionsEnabled
}
else if (feature === experimentalFeatures.discordImportTool) {
localAccountSensitiveSettings.isDiscordImportToolEnabled = !localAccountSensitiveSettings.isDiscordImportToolEnabled
}
else if (feature === experimentalFeatures.communityTokens) {
localAccountSensitiveSettings.isCommunityTokensEnabled = !localAccountSensitiveSettings.isCommunityTokensEnabled
}
}

function toggleFakeLoadingScreen() {
Expand Down
52 changes: 0 additions & 52 deletions ui/app/AppLayouts/Profile/views/AdvancedView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -132,58 +132,6 @@ SettingsContentBase {
}
}

// TODO: replace with StatusQ component
StatusSettingsLineButton {
objectName: "CommunitySettingsLineButton"
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Community Permissions Settings")
isSwitch: true
switchChecked: localAccountSensitiveSettings.isCommunityPermissionsEnabled
onClicked: {
if (!localAccountSensitiveSettings.isCommunityPermissionsEnabled) {
confirmationPopup.experimentalFeature = root.advancedStore.experimentalFeatures.communityPermissions
confirmationPopup.open()
} else {
root.advancedStore.toggleExperimentalFeature(root.advancedStore.experimentalFeatures.communityPermissions)
}
}
}

// TODO: replace with StatusQ component
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Community Tokens")
isSwitch: true
switchChecked: localAccountSensitiveSettings.isCommunityTokensEnabled
onClicked: {
if (!localAccountSensitiveSettings.isCommunityTokensEnabled) {
confirmationPopup.experimentalFeature = root.advancedStore.experimentalFeatures.communityTokens
confirmationPopup.open()
} else {
root.advancedStore.toggleExperimentalFeature(root.advancedStore.experimentalFeatures.communityTokens)
}
}
}

StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Discord Import Tool")
objectName: "DiscordImportToolSettingsLineButton"
isSwitch: true
switchChecked: localAccountSensitiveSettings.isDiscordImportToolEnabled
onClicked: {
if (!localAccountSensitiveSettings.isDiscordImportToolEnabled) {
confirmationPopup.experimentalFeature = root.advancedStore.experimentalFeatures.discordImportTool
confirmationPopup.open()
} else {
root.advancedStore.toggleExperimentalFeature(root.advancedStore.experimentalFeatures.discordImportTool)
}
}
}

// TODO: replace with StatusQ component
StatusSettingsLineButton {
anchors.leftMargin: 0
Expand Down
1 change: 1 addition & 0 deletions ui/imports/shared/panels/CommunityBanner.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Rectangle {

StatusQControls.StatusButton {
id: bannerButton
objectName: "communityBannerButton"
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 16
Expand Down

0 comments on commit 5615a53

Please sign in to comment.