remove some semicolons;

This commit is contained in:
John Gibbon 2020-11-18 11:13:05 +01:00
parent 1486e49f1c
commit 816ba6eca7
3 changed files with 29 additions and 29 deletions

View file

@ -408,26 +408,26 @@ function handleErrorMessage(code, message) {
}
function getMessagesNeededForwardPermissions(messages) {
var neededPermissions = ["can_send_messages"];
var neededPermissions = ["can_send_messages"]
var mediaMessageTypes = ["messageAudio", "messageDocument", "messagePhoto", "messageVideo", "messageVideoNote", "messageVoiceNote"];
var mediaMessageTypes = ["messageAudio", "messageDocument", "messagePhoto", "messageVideo", "messageVideoNote", "messageVoiceNote"]
var otherMessageTypes = ["messageAnimation", "messageGame", "messageSticker"]
for(var i = 0; i < messages.length && neededPermissions.length < 3; i += 1) {
var type = messages[i]["content"]["@type"];
var permission = "";
var type = messages[i]["content"]["@type"]
var permission = ""
if(type === "messageText") {
continue;
continue
} else if(type === "messagePoll") {
permission = "can_send_polls";
permission = "can_send_polls"
} else if(mediaMessageTypes.indexOf(type) > -1) {
permission = "can_send_media_messages";
permission = "can_send_media_messages"
} else if(otherMessageTypes.indexOf(type) > -1) {
permission = "can_send_other_messages";
permission = "can_send_other_messages"
}
if(permission !== "" && neededPermissions.indexOf(permission) === -1) {
neededPermissions.push(permission);
neededPermissions.push(permission)
}
}
return neededPermissions;
return neededPermissions
}

View file

@ -270,8 +270,8 @@ Page {
forwardMessagesTimer.start();
}
function hasSendPrivilege(privilege) {
var groupStatus = chatGroupInformation ? chatGroupInformation.status : null;
var groupStatusType = groupStatus ? groupStatus["@type"] : null;
var groupStatus = chatGroupInformation ? chatGroupInformation.status : null
var groupStatusType = groupStatus ? groupStatus["@type"] : null
return chatPage.isPrivateChat
|| (groupStatusType === "chatMemberStatusMember" && chatInformation.permissions[privilege])
|| groupStatusType === "chatMemberStatusAdministrator"
@ -1216,15 +1216,15 @@ Page {
width: visible ? Theme.itemSizeMedium : 0
icon.source: "image://theme/icon-m-forward"
onClicked: {
var ids = Functions.getMessagesArrayIds(chatPage.selectedMessages);
var neededPermissions = Functions.getMessagesNeededForwardPermissions(chatPage.selectedMessages);
var chatId = chatInformation.id;
var ids = Functions.getMessagesArrayIds(chatPage.selectedMessages)
var neededPermissions = Functions.getMessagesNeededForwardPermissions(chatPage.selectedMessages)
var chatId = chatInformation.id
pageStack.push(Qt.resolvedUrl("../pages/ChatSelectionPage.qml"), {
myUserId: chatPage.myUserId,
headerDescription: qsTr("Forward %n messages", "dialog header", ids.length).arg(ids.length),
payload: {fromChatId: chatId, messageIds:ids, neededPermissions: neededPermissions},
state: "forwardMessages"
});
})
}
}

View file

@ -29,7 +29,7 @@ Dialog {
canAccept: false
acceptDestinationAction: PageStackAction.Replace
acceptDestinationReplaceTarget: pageStack.find( function(page){ return(page._depth === 0)} )
property int myUserId: tdLibWrapper.getUserInformation().id;
property int myUserId: tdLibWrapper.getUserInformation().id
property alias headerTitle: pageHeader.title
property alias headerDescription: pageHeader.description
/*
@ -76,37 +76,37 @@ Dialog {
property bool visible: false
Component.onCompleted: {
if(chatSelectionPage.state === "forwardMessages") {
var chatType = display.type['@type'];
var chatGroupInformation;
var chatType = display.type['@type']
var chatGroupInformation
if(chatType === "chatTypePrivate" || chatType === "chatTypeSecret") {
visible = true
return;
}
else if (chatType === "chatTypeBasicGroup" ) {
chatGroupInformation = tdLibWrapper.getBasicGroup(display.type.basic_group_id);
chatGroupInformation = tdLibWrapper.getBasicGroup(display.type.basic_group_id)
}
else if (chatType === "chatTypeSupergroup" ) {
chatGroupInformation = tdLibWrapper.getSuperGroup(display.type.supergroup_id);
chatGroupInformation = tdLibWrapper.getSuperGroup(display.type.supergroup_id)
}
var groupStatus = chatGroupInformation.status;
var groupStatusType = groupStatus["@type"];
var groupStatusPermissions = groupStatus.permissions;
var groupPermissions = display.permissions;
var groupStatus = chatGroupInformation.status
var groupStatusType = groupStatus["@type"]
var groupStatusPermissions = groupStatus.permissions
var groupPermissions = display.permissions
visible = (groupStatusType === "chatMemberStatusCreator"
|| groupStatusType === "chatMemberStatusAdministrator"
|| (groupStatusType === "chatMemberStatusMember"
&& chatSelectionPage.payload.neededPermissions.every(function(neededPermission){
return groupPermissions[neededPermission];
return groupPermissions[neededPermission]
})
)
|| (groupStatusType === "chatMemberStatusRestricted"
&& chatSelectionPage.payload.neededPermissions.every(function(neededPermission){
return groupStatusPermissions[neededPermission];
return groupStatusPermissions[neededPermission]
})
)
);
)
} else { // future uses of chat selection can be processed here
visible = true;
visible = true
}
}
}