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 { ActionItem {
title: qsTr("Reply") title: qsTr("Reply")
onTriggered: { onTriggered: {
replySheet.text = "@" + ListItemData.user.username + " "; replySheet.text = atMention(ListItemData.user.username);
replySheet.open(); replySheet.open();
replySheet.input.requestFocus(); replySheet.input.requestFocus();
} }
@ -288,7 +288,7 @@ Container {
ActionItem { ActionItem {
title: qsTr("Reply All") title: qsTr("Reply All")
onTriggered: { 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)) console.log(JSON.stringify(ListItemData.content.entities.mentions))
replySheet.open(); replySheet.open();
replySheet.input.requestFocus(); replySheet.input.requestFocus();
@ -383,9 +383,7 @@ Container {
var mtext = "" var mtext = ""
for(var i = 0; i < mentions.length; i++) { for(var i = 0; i < mentions.length; i++) {
var mu = mentions[i].text var mu = mentions[i].text
if (mu !== postitem.ListItem.view.getUserName()) { mtext += atMention(mu)
mtext += "@" + mu + " "
}
} }
if (mtext.length > 0) { if (mtext.length > 0) {
if (postitem.ListItem.view.ccOnReply()) { if (postitem.ListItem.view.ccOnReply()) {
@ -397,4 +395,11 @@ Container {
return "" 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> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="289"/> <location filename="../assets/PostItem.qml" line="290"/>
<source>Reply All</source> <source>Reply All</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="299"/> <location filename="../assets/PostItem.qml" line="301"/>
<source>Delete Bookmark</source> <source>Delete Bookmark</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="299"/> <location filename="../assets/PostItem.qml" line="301"/>
<source>Add Bookmark</source> <source>Add Bookmark</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="310"/> <location filename="../assets/PostItem.qml" line="312"/>
<source>Delete Repost</source> <source>Delete Repost</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="310"/> <location filename="../assets/PostItem.qml" line="312"/>
<source>Repost</source> <source>Repost</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="321"/> <location filename="../assets/PostItem.qml" line="323"/>
<source>Quote</source> <source>Quote</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="330"/> <location filename="../assets/PostItem.qml" line="332"/>
<source>View Profile</source> <source>View Profile</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="337"/> <location filename="../assets/PostItem.qml" line="339"/>
<source>Copy text</source> <source>Copy text</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="367"/> <location filename="../assets/PostItem.qml" line="369"/>
<source>Delete</source> <source>Delete</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>