chore(@community/settings): address PR suggestions

This commit is contained in:
Patryk Osmaczko 2022-06-02 19:48:10 +02:00 committed by osmaczko
parent 51eefad5e5
commit c07a2feca7
5 changed files with 48 additions and 23 deletions

View File

@ -41,8 +41,8 @@ Flickable {
interactive: contentHeight > height
flickableDirection: Flickable.VerticalFlick
implicitWidth: 600
implicitHeight: 800
implicitWidth: layout.implicitWidth
implicitHeight: layout.implicitHeight
ColumnLayout {
id: layout

View File

@ -149,21 +149,25 @@ StatusModal {
id: d
function createCommunity() {
let error = store.createCommunity(
Utils.filterXSS(nameInput.input.text),
Utils.filterXSS(descriptionTextInput.input.text),
Utils.filterXSS(introMessageInput.input.text),
Utils.filterXSS(outroMessageInput.input.text),
options.requestToJoinEnabled ? Constants.communityChatOnRequestAccess : Constants.communityChatPublicAccess,
colorPicker.color.toString().toUpperCase(),
logoPicker.source,
logoPicker.cropRect.x,
logoPicker.cropRect.y,
logoPicker.cropRect.x + logoPicker.cropRect.width,
logoPicker.cropRect.y + logoPicker.cropRect.height,
options.archiveSupportEnabled,
options.pinMessagesEnabled
)
const error = store.createCommunity({
name: Utils.filterXSS(nameInput.input.text),
description: Utils.filterXSS(descriptionTextInput.input.text),
introMessage: Utils.filterXSS(introMessageInput.input.text),
outroMessage: Utils.filterXSS(outroMessageInput.input.text),
color: colorPicker.color.toString().toUpperCase(),
image: {
src: logoPicker.source,
AX: logoPicker.cropRect.x,
AY: logoPicker.cropRect.y,
BX: logoPicker.cropRect.x + logoPicker.cropRect.width,
BY: logoPicker.cropRect.y + logoPicker.cropRect.height,
},
options: {
historyArchiveSupportEnabled: options.archiveSupportEnabled,
checkedMembership: options.requestToJoinEnabled ? Constants.communityChatOnRequestAccess : Constants.communityChatPublicAccess,
pinMessagesAllowedForMembers: options.pinMessagesEnabled
}
})
if (error) {
errorDialog.text = error.error
errorDialog.open()

View File

@ -230,8 +230,29 @@ QtObject {
// Not Refactored Yet
property var activeCommunityChatsModel: "" //chatsModelInst.communities.activeCommunity.chats
function createCommunity(name, description, introMessage, outroMessage, checkedMembership, color, image, imageAX, imageAY, imageBX, imageBY, historyArchiveSupportEnabled, pinMessagesAllowedForMembers) {
communitiesModuleInst.createCommunity(name, description, introMessage, outroMessage, checkedMembership, color, image, imageAX, imageAY, imageBX, imageBY, historyArchiveSupportEnabled, pinMessagesAllowedForMembers);
function createCommunity(args = {
name: "",
description: "",
introMessage: "",
outroMessage: "",
color: "",
image: {
src: "",
AX: 0,
AY: 0,
BX: 0,
BY: 0,
},
options: {
historyArchiveSupportEnabled: false,
checkedMembership: false,
pinMessagesAllowedForMembers: false
}
}) {
return communitiesModuleInst.createCommunity(
args.name, args.description, args.introMessage, args.outroMessage, args.options.checkedMembership, args.color,
args.image.src, args.image.AX, args.image.AY, args.image.BX, args.image.BY,
args.options.historyArchiveSupportEnabled, args.options.pinMessagesAllowedForMembers);
}
function importCommunity(communityKey) {

View File

@ -129,7 +129,7 @@ StatusAppTwoPanelLayout {
editable: root.community.amISectionAdmin
onEdited: {
let error = root.chatCommunitySectionModule.editCommunity(
const error = root.chatCommunitySectionModule.editCommunity(
Utils.filterXSS(item.name),
Utils.filterXSS(item.description),
Utils.filterXSS(item.introMessage),

View File

@ -309,8 +309,7 @@ Item {
width: parent.width
height: 54
enabled: true
//% "Unsupported state"
text: qsTrId("unsupported-state")
text: qsTr("Unsupported state")
onClicked: {
let onBtnClick = function(){
@ -319,7 +318,8 @@ Item {
if (rectangleBubble.state === "joined") {
root.store.setActiveCommunity(communityId);
return
} else if (rectangleBubble.state === "unjoined") {
}
if (rectangleBubble.state === "unjoined") {
Global.openPopup(communityIntroDialog, { joinMethod: () => {
let error = root.store.joinCommunity(communityId)
if (error) joiningError.showError(error)