Fixed blocking was to 1 account because of typo + Trying to Implement matches

* Matches are a "follow" on Mastodon. As accounts are always private, the other party
 has to accept the follow (match)
This commit is contained in:
Bofh 2021-01-10 20:20:55 +01:00
parent e897a4c99d
commit 5c1fc7cb13
1 changed files with 20 additions and 4 deletions

View File

@ -26,7 +26,12 @@ const fediloveMastodon = {
}, },
API: { API: {
discardAccount: function(account_id, cback) { discardAccount: function(account_id, cback) {
fediloveMastodon.post('/api/v1/accounts/18084/block', {}, function(data) { cback() }); fediloveMastodon.post(`/api/v1/accounts/${account_id}/block`, {}, function(data) { cback() });
},
matchAccount: function(account_id, cback) {
fediloveMastodon.post(`/api/v1/accounts/${account_id}/follow`, {'reblogs': true},
function(data) { cback() }
);
}, },
statusFav: function(dom, status_id) { statusFav: function(dom, status_id) {
var dislike = false; var dislike = false;
@ -232,7 +237,16 @@ var fediloveUI = {
setTimeout(function() { window.history.back() }, 220); setTimeout(function() { window.history.back() }, 220);
}); });
}, },
onAccountMatch: function() {}, onAccountMatch: function() {
const accObj = fediloveApi.getMeetAccount();
if (accObj === undefined) return;
if (!fediloveData.tmpDiscardedAccounts.includes(accObj.id))
fediloveData.tmpDiscardedAccounts.push(accObj.id);
fediloveMastodon.API.matchAccount(accObj.id, function() {
$('div.virtual-list')[0].style.animation = 'yepMeet .25s linear 1';
setTimeout(function() { window.history.back() }, 220);
});
},
onAccountMaybe: function() {} onAccountMaybe: function() {}
}; };
@ -449,6 +463,10 @@ function fedilove_customization() {
0% {position: relative; top: 0} 0% {position: relative; top: 0}
100% {position: relative; top: 95vh} 100% {position: relative; top: 95vh}
} }
@keyframes yepMeet {
0% {position: relative; top: 0}
100% {position: relative; top: -95vh}
}
`; `;
document.body.appendChild(style); document.body.appendChild(style);
} }
@ -679,8 +697,6 @@ function fedilove_customization() {
$('div#noone-to-meet')[0].style = ''; $('div#noone-to-meet')[0].style = '';
} }
prevItems = items;
}, 200); }, 200);
} }
else if (window.location.pathname.startsWith('/notifications/mentions')) { else if (window.location.pathname.startsWith('/notifications/mentions')) {