public void ReportAsSpam() { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "ユーザーをスパムとして報告", MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "ユーザー " + this.Status.User.ScreenName + " をスパム報告しますか?", Content = "全てのアカウントからブロックし、代表のアカウントからスパム報告します。", CustomButtons = new[] { "スパム報告", "キャンセル" }, AllowDialogCancellation = true, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) { return; } // report as a spam var accounts = Setting.Accounts.Collection.ToArray(); var reporter = accounts.FirstOrDefault(); if (reporter == null) { return; } var rreq = new UpdateRelationRequest(this.User.User, RelationKind.Block); accounts.ToObservable() .SelectMany(a => RequestQueue.Enqueue(a, rreq) .Do(r => BackstageModel.RegisterEvent( new BlockedEvent(a.GetPserudoUser(), this.User.User)))) .Merge( RequestQueue.Enqueue(reporter, new UpdateRelationRequest(this.User.User, RelationKind.ReportAsSpam)) .Do(r => BackstageModel.RegisterEvent( new BlockedEvent(reporter.GetPserudoUser(), this.User.User)))) .Subscribe( _ => { }, ex => BackstageModel.RegisterEvent(new InternalErrorEvent(ex.Message)), () => { var tid = this.Status.User.Id; var tidstr = tid.ToString(CultureInfo.InvariantCulture); StatusProxy.FetchStatuses( s => s.User.Id == tid || (s.RetweetedOriginal != null && s.RetweetedOriginal.User.Id == tid), "UserId = " + tidstr + " OR BaseUserId = " + tidstr) .Subscribe(s => StatusInbox.EnqueueRemoval(s.Id)); }); }
public void ReportAsSpam() { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = "ユーザーをスパムとして報告", MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = "ユーザー " + this.Status.User.ScreenName + " をスパム報告しますか?", Content = "全てのアカウントからブロックし、代表のアカウントからスパム報告します。", CustomButtons = new[] { "スパム報告", "キャンセル" }, AllowDialogCancellation = true, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) return; // report as a spam var accounts = Setting.Accounts.Collection.ToArray(); var reporter = accounts.FirstOrDefault(); if (reporter == null) return; var rreq = new UpdateRelationRequest(this.User.User, RelationKind.Block); accounts.ToObservable() .SelectMany(a => RequestQueue.Enqueue(a, rreq) .Do(r => BackstageModel.RegisterEvent( new BlockedEvent(a.GetPserudoUser(), this.User.User)))) .Merge( RequestQueue.Enqueue(reporter, new UpdateRelationRequest(this.User.User, RelationKind.ReportAsSpam)) .Do(r => BackstageModel.RegisterEvent( new BlockedEvent(reporter.GetPserudoUser(), this.User.User)))) .Subscribe( _ => { }, ex => BackstageModel.RegisterEvent(new InternalErrorEvent(ex.Message)), () => { var targetId = this.Status.User.Id.ToString(CultureInfo.InvariantCulture); StatusProxy.FetchStatuses("UserId = " + targetId + " OR BaseUserId = " + targetId) .Subscribe(s => StatusInbox.QueueRemoval(s.Id)); }); }
public void ReportAsSpam() { var msg = new TaskDialogMessage(new TaskDialogOptions { Title = MainAreaTimelineResources.MsgReportAsSpamTitle, MainIcon = VistaTaskDialogIcon.Warning, MainInstruction = String.Format(MainAreaTimelineResources.MsgReportAsSpamInst, "@" + this.Status.User.ScreenName), Content = MainAreaTimelineResources.MsgReportAsSpamContent, CustomButtons = new[] { MainAreaTimelineResources.MsgReportAsSpamCmdReportAsSpam, Resources.MsgButtonCancel }, DefaultButtonIndex = 0, AllowDialogCancellation = true, }); var response = this.Parent.Messenger.GetResponse(msg); if (response.Response.CustomButtonResult != 0) return; // report as a spam var accounts = Setting.Accounts.Collection.ToArray(); var reporter = accounts.FirstOrDefault(); if (reporter == null) return; var rreq = new UpdateRelationRequest(this.User.User, RelationKind.Block); accounts.ToObservable() .SelectMany(a => RequestQueue.Enqueue(a, rreq) .Do(r => BackstageModel.RegisterEvent( new BlockedEvent(a.GetPserudoUser(), this.User.User)))) .Merge( RequestQueue.Enqueue(reporter, new UpdateRelationRequest(this.User.User, RelationKind.ReportAsSpam)) .Do(r => BackstageModel.RegisterEvent( new BlockedEvent(reporter.GetPserudoUser(), this.User.User)))) .Subscribe( _ => { }, ex => BackstageModel.RegisterEvent(new InternalErrorEvent(ex.Message)), () => { var tid = this.Status.User.Id; var tidstr = tid.ToString(CultureInfo.InvariantCulture); StatusProxy.FetchStatuses( s => s.User.Id == tid || (s.RetweetedOriginal != null && s.RetweetedOriginal.User.Id == tid), "UserId = " + tidstr + " OR BaseUserId = " + tidstr) .Subscribe(s => StatusInbox.EnqueueRemoval(s.Id)); }); }