Get mentions from content
FossilOrigin-Name: 29716d4f981e4cc8750de01a82dea395044c472165ede67954ac7cc781c3532d
This commit is contained in:
parent
3ac0145efc
commit
19f5e5c14d
|
@ -50,7 +50,16 @@ sub format_username
|
|||
|
||||
sub get_mentions_from_content
|
||||
{
|
||||
my $status = shift;
|
||||
my ($ssn, $status) = @_;
|
||||
my $result = '';
|
||||
my $acct;
|
||||
# todo
|
||||
"";
|
||||
while ($status->{'content'} =~
|
||||
/<a .*?href=\"https?:\/\/(.*?)\/(?:@|users\/|u\/)?(.*?)?\".*?>@(?:<span>)?.*?(?:<\/span>)?/gs)
|
||||
{
|
||||
$acct = $2 . '@' . $1;
|
||||
$result .= '@' . $acct . ' ' if $ssn->{account}->{acct} eq $acct;
|
||||
}
|
||||
($status->{account}->{acct} eq $ssn->{account}->{acct})
|
||||
? $result : '@' . $status->{account}->{acct} . ' ' . $result;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ char* construct_post_box(struct mstdnt_status* reply_status,
|
|||
* so we just grep for regex href
|
||||
* - Misskey/Mastodon adds an @ symbol in the href param, while pleroma adds /users and honk adds /u
|
||||
*/
|
||||
#define REGEX_REPLY "<a .*?href=\"https?:\\/\\/(.*?)\\/(?:@|users/|u/)?(.*?)?\".*?>@(?:<span>)?.*?(?:<\\/span>)?"
|
||||
#define REGEX_REPLY ""
|
||||
|
||||
char* reply_status(struct session* ssn, char* id, struct mstdnt_status* status)
|
||||
{
|
||||
|
|
|
@ -3,11 +3,7 @@
|
|||
<input type="hidden" name="replyid" value="[% status.in_reply_to_id %]">
|
||||
[% END %]
|
||||
<div class="statusbox">
|
||||
<textarea name="content" placeholder="Just landed in N.Y." rows="5">
|
||||
[%- IF status -%]
|
||||
[%- mentionify(status) -%]
|
||||
[%- END -%]
|
||||
</textarea>
|
||||
<textarea name="content" placeholder="Just landed in N.Y." rows="5">[% IF status %][% mentionify(ssn, status) %][% END %]</textarea>
|
||||
<div class="statusfooter">
|
||||
<div class="statusfooter-left">
|
||||
<label>
|
||||
|
|
Loading…
Reference in a new issue