Merge branch 'unique-embed-urls' into 'master'

Ensure unique embed URLs

Closes #41

See merge request chicken-riders/RcGcDb!19
This commit is contained in:
Frisk 2021-05-11 16:55:43 +00:00
commit dba037e1e9
2 changed files with 9 additions and 1 deletions

View file

@ -185,6 +185,10 @@ async def feeds_embed_formatter(post_type, post, message_target, wiki, article_p
embed.add_field(_("Report this on the support server"), settings["support"])
else:
embed.add_field(_("Report this on the support server"), change_params)
if "?" in embed["url"]:
embed["url"] = embed["url"] + "&_rcid={}".format(post["id"])
else:
embed["url"] = embed["url"] + "?_rcid={}".format(post["id"])
embed.finish_embed()
return embed

View file

@ -1149,5 +1149,9 @@ async def embed_formatter(action, change, parsed_comment, categories, recent_cha
new_cat = (_("**Added**: ") + ", ".join(list(categories["new"])[0:16]) + ("\n" if len(categories["new"])<=15 else _(" and {} more\n").format(len(categories["new"])-15))) if categories["new"] else ""
del_cat = (_("**Removed**: ") + ", ".join(list(categories["removed"])[0:16]) + ("" if len(categories["removed"])<=15 else _(" and {} more").format(len(categories["removed"])-15))) if categories["removed"] else ""
embed.add_field(_("Changed categories"), new_cat + del_cat)
if "?" in embed["url"]:
embed["url"] = embed["url"] + "&_rcid={}".format(change["rcid"])
else:
embed["url"] = embed["url"] + "?_rcid={}".format(change["rcid"])
embed.finish_embed()
return embed