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 interactive: contentHeight > height
flickableDirection: Flickable.VerticalFlick flickableDirection: Flickable.VerticalFlick
implicitWidth: 600 implicitWidth: layout.implicitWidth
implicitHeight: 800 implicitHeight: layout.implicitHeight
ColumnLayout { ColumnLayout {
id: layout id: layout

View File

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

View File

@ -230,8 +230,29 @@ QtObject {
// Not Refactored Yet // Not Refactored Yet
property var activeCommunityChatsModel: "" //chatsModelInst.communities.activeCommunity.chats property var activeCommunityChatsModel: "" //chatsModelInst.communities.activeCommunity.chats
function createCommunity(name, description, introMessage, outroMessage, checkedMembership, color, image, imageAX, imageAY, imageBX, imageBY, historyArchiveSupportEnabled, pinMessagesAllowedForMembers) { function createCommunity(args = {
communitiesModuleInst.createCommunity(name, description, introMessage, outroMessage, checkedMembership, color, image, imageAX, imageAY, imageBX, imageBY, historyArchiveSupportEnabled, pinMessagesAllowedForMembers); 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) { function importCommunity(communityKey) {

View File

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

View File

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