remove some semicolons;
This commit is contained in:
parent
1486e49f1c
commit
816ba6eca7
3 changed files with 29 additions and 29 deletions
|
@ -408,26 +408,26 @@ function handleErrorMessage(code, message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMessagesNeededForwardPermissions(messages) {
|
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"]
|
var otherMessageTypes = ["messageAnimation", "messageGame", "messageSticker"]
|
||||||
for(var i = 0; i < messages.length && neededPermissions.length < 3; i += 1) {
|
for(var i = 0; i < messages.length && neededPermissions.length < 3; i += 1) {
|
||||||
var type = messages[i]["content"]["@type"];
|
var type = messages[i]["content"]["@type"]
|
||||||
var permission = "";
|
var permission = ""
|
||||||
if(type === "messageText") {
|
if(type === "messageText") {
|
||||||
continue;
|
continue
|
||||||
} else if(type === "messagePoll") {
|
} else if(type === "messagePoll") {
|
||||||
permission = "can_send_polls";
|
permission = "can_send_polls"
|
||||||
} else if(mediaMessageTypes.indexOf(type) > -1) {
|
} else if(mediaMessageTypes.indexOf(type) > -1) {
|
||||||
permission = "can_send_media_messages";
|
permission = "can_send_media_messages"
|
||||||
} else if(otherMessageTypes.indexOf(type) > -1) {
|
} else if(otherMessageTypes.indexOf(type) > -1) {
|
||||||
permission = "can_send_other_messages";
|
permission = "can_send_other_messages"
|
||||||
}
|
}
|
||||||
|
|
||||||
if(permission !== "" && neededPermissions.indexOf(permission) === -1) {
|
if(permission !== "" && neededPermissions.indexOf(permission) === -1) {
|
||||||
neededPermissions.push(permission);
|
neededPermissions.push(permission)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return neededPermissions;
|
return neededPermissions
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,8 +270,8 @@ Page {
|
||||||
forwardMessagesTimer.start();
|
forwardMessagesTimer.start();
|
||||||
}
|
}
|
||||||
function hasSendPrivilege(privilege) {
|
function hasSendPrivilege(privilege) {
|
||||||
var groupStatus = chatGroupInformation ? chatGroupInformation.status : null;
|
var groupStatus = chatGroupInformation ? chatGroupInformation.status : null
|
||||||
var groupStatusType = groupStatus ? groupStatus["@type"] : null;
|
var groupStatusType = groupStatus ? groupStatus["@type"] : null
|
||||||
return chatPage.isPrivateChat
|
return chatPage.isPrivateChat
|
||||||
|| (groupStatusType === "chatMemberStatusMember" && chatInformation.permissions[privilege])
|
|| (groupStatusType === "chatMemberStatusMember" && chatInformation.permissions[privilege])
|
||||||
|| groupStatusType === "chatMemberStatusAdministrator"
|
|| groupStatusType === "chatMemberStatusAdministrator"
|
||||||
|
@ -1216,15 +1216,15 @@ Page {
|
||||||
width: visible ? Theme.itemSizeMedium : 0
|
width: visible ? Theme.itemSizeMedium : 0
|
||||||
icon.source: "image://theme/icon-m-forward"
|
icon.source: "image://theme/icon-m-forward"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var ids = Functions.getMessagesArrayIds(chatPage.selectedMessages);
|
var ids = Functions.getMessagesArrayIds(chatPage.selectedMessages)
|
||||||
var neededPermissions = Functions.getMessagesNeededForwardPermissions(chatPage.selectedMessages);
|
var neededPermissions = Functions.getMessagesNeededForwardPermissions(chatPage.selectedMessages)
|
||||||
var chatId = chatInformation.id;
|
var chatId = chatInformation.id
|
||||||
pageStack.push(Qt.resolvedUrl("../pages/ChatSelectionPage.qml"), {
|
pageStack.push(Qt.resolvedUrl("../pages/ChatSelectionPage.qml"), {
|
||||||
myUserId: chatPage.myUserId,
|
myUserId: chatPage.myUserId,
|
||||||
headerDescription: qsTr("Forward %n messages", "dialog header", ids.length).arg(ids.length),
|
headerDescription: qsTr("Forward %n messages", "dialog header", ids.length).arg(ids.length),
|
||||||
payload: {fromChatId: chatId, messageIds:ids, neededPermissions: neededPermissions},
|
payload: {fromChatId: chatId, messageIds:ids, neededPermissions: neededPermissions},
|
||||||
state: "forwardMessages"
|
state: "forwardMessages"
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ Dialog {
|
||||||
canAccept: false
|
canAccept: false
|
||||||
acceptDestinationAction: PageStackAction.Replace
|
acceptDestinationAction: PageStackAction.Replace
|
||||||
acceptDestinationReplaceTarget: pageStack.find( function(page){ return(page._depth === 0)} )
|
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 headerTitle: pageHeader.title
|
||||||
property alias headerDescription: pageHeader.description
|
property alias headerDescription: pageHeader.description
|
||||||
/*
|
/*
|
||||||
|
@ -76,37 +76,37 @@ Dialog {
|
||||||
property bool visible: false
|
property bool visible: false
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if(chatSelectionPage.state === "forwardMessages") {
|
if(chatSelectionPage.state === "forwardMessages") {
|
||||||
var chatType = display.type['@type'];
|
var chatType = display.type['@type']
|
||||||
var chatGroupInformation;
|
var chatGroupInformation
|
||||||
if(chatType === "chatTypePrivate" || chatType === "chatTypeSecret") {
|
if(chatType === "chatTypePrivate" || chatType === "chatTypeSecret") {
|
||||||
visible = true
|
visible = true
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (chatType === "chatTypeBasicGroup" ) {
|
else if (chatType === "chatTypeBasicGroup" ) {
|
||||||
chatGroupInformation = tdLibWrapper.getBasicGroup(display.type.basic_group_id);
|
chatGroupInformation = tdLibWrapper.getBasicGroup(display.type.basic_group_id)
|
||||||
}
|
}
|
||||||
else if (chatType === "chatTypeSupergroup" ) {
|
else if (chatType === "chatTypeSupergroup" ) {
|
||||||
chatGroupInformation = tdLibWrapper.getSuperGroup(display.type.supergroup_id);
|
chatGroupInformation = tdLibWrapper.getSuperGroup(display.type.supergroup_id)
|
||||||
}
|
}
|
||||||
var groupStatus = chatGroupInformation.status;
|
var groupStatus = chatGroupInformation.status
|
||||||
var groupStatusType = groupStatus["@type"];
|
var groupStatusType = groupStatus["@type"]
|
||||||
var groupStatusPermissions = groupStatus.permissions;
|
var groupStatusPermissions = groupStatus.permissions
|
||||||
var groupPermissions = display.permissions;
|
var groupPermissions = display.permissions
|
||||||
visible = (groupStatusType === "chatMemberStatusCreator"
|
visible = (groupStatusType === "chatMemberStatusCreator"
|
||||||
|| groupStatusType === "chatMemberStatusAdministrator"
|
|| groupStatusType === "chatMemberStatusAdministrator"
|
||||||
|| (groupStatusType === "chatMemberStatusMember"
|
|| (groupStatusType === "chatMemberStatusMember"
|
||||||
&& chatSelectionPage.payload.neededPermissions.every(function(neededPermission){
|
&& chatSelectionPage.payload.neededPermissions.every(function(neededPermission){
|
||||||
return groupPermissions[neededPermission];
|
return groupPermissions[neededPermission]
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|| (groupStatusType === "chatMemberStatusRestricted"
|
|| (groupStatusType === "chatMemberStatusRestricted"
|
||||||
&& chatSelectionPage.payload.neededPermissions.every(function(neededPermission){
|
&& chatSelectionPage.payload.neededPermissions.every(function(neededPermission){
|
||||||
return groupStatusPermissions[neededPermission];
|
return groupStatusPermissions[neededPermission]
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
)
|
||||||
} else { // future uses of chat selection can be processed here
|
} else { // future uses of chat selection can be processed here
|
||||||
visible = true;
|
visible = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue