}
[Fact]
+ public void CanRetweetBy_DMTest()
+ {
+ var post = new TestPostClass
+ {
+ IsDm = true,
+ IsMe = false, // 自分が受け取った DM
+ UserId = 222L, // 送信元ユーザーID
+ };
+
+ Assert.False(post.CanRetweetBy(selfUserId: 111L));
+ }
+
+ [Fact]
+ public void CanRetweetBy_MyTweetTest()
+ {
+ var post = new TestPostClass
+ {
+ UserId = 111L, // 自分のツイート
+ };
+
+ Assert.True(post.CanRetweetBy(selfUserId: 111L));
+ }
+
+ [Fact]
+ public void CanRetweetBy_ProtectedMyTweetTest()
+ {
+ var post = new TestPostClass
+ {
+ UserId = 111L, // 自分のツイート
+ IsProtect = true,
+ };
+
+ Assert.True(post.CanRetweetBy(selfUserId: 111L));
+ }
+
+ [Fact]
+ public void CanRetweetBy_OthersTweet_NotProtectedTest()
+ {
+ var post = new TestPostClass
+ {
+ UserId = 222L, // 他人のツイート
+ IsProtect = false,
+ };
+
+ Assert.True(post.CanRetweetBy(selfUserId: 111L));
+ }
+
+ [Fact]
+ public void CanRetweetBy_OthersTweet_ProtectedTest()
+ {
+ var post = new TestPostClass
+ {
+ UserId = 222L, // 他人のツイート
+ IsProtect = true,
+ };
+
+ Assert.False(post.CanRetweetBy(selfUserId: 111L));
+ }
+
+ [Fact]
public void ConvertToOriginalPost_Test()
{
var retweetPost = new PostClass
return false;
}
+ /// <summary>
+ /// このツイートが指定したユーザーによってリツイート可能であるかを判定します
+ /// </summary>
+ /// <param name="selfUserId">リツイートしようとするユーザーのID</param>
+ /// <returns>リツイート可能であれば true、そうでなければ false</returns>
+ public bool CanRetweetBy(long selfUserId)
+ {
+ // DM は常にリツイート不可
+ if (this.IsDm)
+ return false;
+
+ // 自分のツイートであれば鍵垢であるかに関わらずリツイート可
+ if (this.UserId == selfUserId)
+ return true;
+
+ return !this.IsProtect;
+ }
+
public PostClass ConvertToOriginalPost()
{
if (this.RetweetedId == null)
更新履歴
==== Ver 1.3.6-dev(2016/xx/xx)
+ * CHG: 非公開アカウントであっても自分自身のツイートを公式RTできるようになりました
* FIX: 発言詳細部のプロフィール画像に誤ったユーザーの画像が表示されることがある不具合を修正
* FIX: ツイートURLのコピー時に余分な改行文字が末尾に付く不具合を修正
* FIX: Bing翻訳機能が使用できなくなっていた問題を修正
FavorareMenuItem.Enabled = true;
ShowRelatedStatusesMenuItem.Enabled = true; //PublicSearchの時問題出るかも
- if (_curPost.IsProtect)
+ if (!_curPost.CanRetweetBy(this.twitterApi.CurrentUserId))
{
ReTweetStripMenuItem.Enabled = false;
ReTweetUnofficialStripMenuItem.Enabled = false;
//公式RT
if (this.ExistCurrentPost)
{
- if (_curPost.IsProtect)
+ if (!_curPost.CanRetweetBy(this.twitterApi.CurrentUserId))
{
- MessageBox.Show("Protected.");
+ if (this._curPost.IsProtect)
+ MessageBox.Show("Protected.");
+
_DoFavRetweetFlags = false;
return;
}
}
else
{
- if (_curPost.IsDm)
- {
- _DoFavRetweetFlags = false;
- return;
- }
if (!this._cfgCommon.RetweetNoConfirm)
{
string Questiontext = Properties.Resources.RetweetQuestion1;
foreach (int idx in _curList.SelectedIndices)
{
PostClass post = GetCurTabPost(idx);
- if (!post.IsProtect && !post.IsDm)
+ if (post.CanRetweetBy(this.twitterApi.CurrentUserId))
statusIds.Add(post.StatusId);
}
this.OpenFavotterOpMenuItem.Enabled = true;
this.ShowRelatedStatusesMenuItem2.Enabled = true; //PublicSearchの時問題出るかも
- if (_curPost.IsProtect)
+ if (!_curPost.CanRetweetBy(this.twitterApi.CurrentUserId))
{
this.RtOpMenuItem.Enabled = false;
this.RtUnOpMenuItem.Enabled = false;