Mention all users when replying

This commit is contained in:
bleakgrey 2018-06-06 17:49:13 +03:00
parent a5c5ddbf04
commit 47d1ba1d4a
3 changed files with 17 additions and 3 deletions

View File

@ -5,7 +5,7 @@ public class Tootle.Mention{
public string acct;
public string url;
public Mention(int64 id){
public Mention (int64 id){
this.id = id;
}
public Mention.from_account(Account account){

View File

@ -81,6 +81,20 @@ public class Tootle.Status {
return get_formal ().account.id == Tootle.accounts.current.id;
}
public string get_reply_mentions () {
var result = "";
if (account.acct != accounts.current.acct)
result = "@%s ".printf (account.acct);
if (mentions != null) {
foreach (var mention in mentions)
if (mention.acct != accounts.current.acct)
result += "@%s ".printf (mention.acct);
}
return result;
}
public void set_reblogged (bool rebl = true){
var action = rebl ? "reblog" : "unreblog";
var msg = new Soup.Message("POST", "%s/api/v1/statuses/%lld/%s".printf (Tootle.accounts.formal.instance, id, action));

View File

@ -164,7 +164,7 @@ public class Tootle.PostDialog : Gtk.Dialog {
dialog.text.buffer.text = text;
}
else if (text != null)
dialog.text.buffer.text += " " + text;
dialog.text.buffer.text += text;
}
public static void open_reply (Status reply_to) {
@ -172,7 +172,7 @@ public class Tootle.PostDialog : Gtk.Dialog {
return;
open (null, reply_to);
dialog.text.buffer.text = "@%s ".printf (reply_to.account.acct);
dialog.text.buffer.text = reply_to.get_reply_mentions ();
}
public void publish_post () {