filter out the current username from all reply types issue #51

This commit is contained in:
Morgan McMillian 2019-08-03 17:33:50 -07:00
parent 3b2b578533
commit 8d0a707765
2 changed files with 19 additions and 14 deletions

View file

@ -279,7 +279,7 @@ Container {
ActionItem {
title: qsTr("Reply")
onTriggered: {
replySheet.text = "@" + ListItemData.user.username + " ";
replySheet.text = atMention(ListItemData.user.username);
replySheet.open();
replySheet.input.requestFocus();
}
@ -288,7 +288,7 @@ Container {
ActionItem {
title: qsTr("Reply All")
onTriggered: {
replySheet.text = "@" + ListItemData.user.username + " " + parseMentions(ListItemData.content.entities.mentions);
replySheet.text = atMention(ListItemData.user.username) + parseMentions(ListItemData.content.entities.mentions);
console.log(JSON.stringify(ListItemData.content.entities.mentions))
replySheet.open();
replySheet.input.requestFocus();
@ -383,9 +383,7 @@ Container {
var mtext = ""
for(var i = 0; i < mentions.length; i++) {
var mu = mentions[i].text
if (mu !== postitem.ListItem.view.getUserName()) {
mtext += "@" + mu + " "
}
mtext += atMention(mu)
}
if (mtext.length > 0) {
if (postitem.ListItem.view.ccOnReply()) {
@ -397,4 +395,11 @@ Container {
return ""
}
}
function atMention(username) {
var atname = ""
if (username !== postitem.ListItem.view.getUserName()) {
atname = "@" + username + " "
}
return atname
}
}

View file

@ -48,47 +48,47 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="289"/>
<location filename="../assets/PostItem.qml" line="290"/>
<source>Reply All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="299"/>
<location filename="../assets/PostItem.qml" line="301"/>
<source>Delete Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="299"/>
<location filename="../assets/PostItem.qml" line="301"/>
<source>Add Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="310"/>
<location filename="../assets/PostItem.qml" line="312"/>
<source>Delete Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="310"/>
<location filename="../assets/PostItem.qml" line="312"/>
<source>Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="321"/>
<location filename="../assets/PostItem.qml" line="323"/>
<source>Quote</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="330"/>
<location filename="../assets/PostItem.qml" line="332"/>
<source>View Profile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="337"/>
<location filename="../assets/PostItem.qml" line="339"/>
<source>Copy text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="367"/>
<location filename="../assets/PostItem.qml" line="369"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>