From ad7b3cf485301f0804a5fd2a10358f3b52a1a684 Mon Sep 17 00:00:00 2001 From: cutls Date: Fri, 12 Jun 2020 22:13:06 +0900 Subject: [PATCH] follow request --- app/js/post/status.js | 13 ++++++++++++- app/js/userdata/showOnTL.js | 14 +++++++++++++- app/view/make/language/en/main.json | 1 + app/view/make/language/ja/main.json | 1 + 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/app/js/post/status.js b/app/js/post/status.js index 56ed2605..c4a37ae1 100644 --- a/app/js/post/status.js +++ b/app/js/post/status.js @@ -160,8 +160,14 @@ function bkm(id, acct_id, tlid) { //フォロー async function follow(acct_id, resolve) { + if($('#his-data').hasClass('locked')) { + locked = true + } else { + locked = false + } if (!acct_id && acct_id != 'selector') { var acct_id = $('#his-data').attr('use-acct') + } else if (acct_id == 'selector') { var acct_id = $('#user-acct-sel').val() } @@ -172,6 +178,7 @@ async function follow(acct_id, resolve) { var flag = 'follow' var flagm = 'create' } + var id = $('#his-data').attr('user-id') if (resolve == 'selector') { var fullacct = $('#his-acct').attr('fullname') @@ -205,7 +212,11 @@ async function follow(acct_id, resolve) { $('#his-follow-btn-text').text(lang.lang_status_follow) } else { $('#his-data').addClass('following') - $('#his-follow-btn-text').text(lang.lang_status_unfollow) + if(locked) { + $('#his-follow-btn-text').text(lang.lang_status_requesting) + } else { + $('#his-follow-btn-text').text(lang.lang_status_unfollow) + } } } } diff --git a/app/js/userdata/showOnTL.js b/app/js/userdata/showOnTL.js index 5310c9cf..21d412a6 100644 --- a/app/js/userdata/showOnTL.js +++ b/app/js/userdata/showOnTL.js @@ -239,6 +239,11 @@ function udg(user, acct_id) { $(".only-his-data").show(); } todc(); + if(json.locked) { + $('#his-data').addClass('locked') + } else { + $('#his-data').removeClass('locked') + } //外部データ取得(死かもしれないので) udAdd(acct_id, user, json.url); }); @@ -412,9 +417,14 @@ function relations(user, acct_id) { }) .then(function(json) { var json = json[0]; + if(json.requested) { + //フォロリク中 + $('#his-data').addClass('following') + $("#his-follow-btn-text").text(lang.lang_status_requesting) + } if (json.following) { //自分がフォローしている - $("#his-data").addClass("following"); + $("#his-data").addClass("following") $("#his-follow-btn-text").text(lang.lang_status_unfollow); hisList(user, acct_id); } else { @@ -538,6 +548,8 @@ function reset() { $("#his-float-blocked").hide(); $("#his-main-acct").show(); $("#his-proof-prof").html(""); + $('#his-data').removeClass('locked') + $('#his-data').removeClass('requesting') } $("#my-data-nav .anc-link").on("click", function() { var target = $(this).attr("go"); diff --git a/app/view/make/language/en/main.json b/app/view/make/language/en/main.json index e1314495..777bc61b 100644 --- a/app/view/make/language/en/main.json +++ b/app/view/make/language/en/main.json @@ -166,6 +166,7 @@ "lang_showontl_domain": "Domain ", "lang_showontl_listwarn": "Follow to add this user to lists.", "lang_showontl_verified": "This website is verified by owner at ", + "lang_status_requesting": "Requesting", "lang_parse_mentioned": " replied to you", "lang_parse_faved": " favourited your toot", "lang_parse_bted": " boosted your toot", diff --git a/app/view/make/language/ja/main.json b/app/view/make/language/ja/main.json index cc4a2e56..c568387a 100644 --- a/app/view/make/language/ja/main.json +++ b/app/view/make/language/ja/main.json @@ -167,6 +167,7 @@ "lang_showontl_domain": "ドメイン", "lang_showontl_listwarn": "リストに追加するためにはフォローが必要です。", "lang_showontl_verified": "このユーザーの所持するWebサイトであると証明されています。", + "lang_status_requesting": "フォローをリクエストしています", "lang_parse_mentioned": "が返信しました", "lang_parse_faved": "がお気に入り登録しました", "lang_parse_bted": "がブーストしました",