Microsoft Teams: Patch Missing Conversations

Hot patch "missing conversations" bug where threads are truncated at 2-3 replies

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Microsoft Teams: Patch Missing Conversations
// @namespace   http://www.asaurus.net/
// @description Hot patch "missing conversations" bug where threads are truncated at 2-3 replies
//              and old threads won't populate, after a channel switch.
//              Author: Kevin Buhr <[email protected]>
// @match       https://teams.microsoft.com/*
// @version     1.1
// @grant       none
// @license     Public Domain
// ==/UserScript==

var prefix = "Patch Missing Conversations: ";
(function loop() {
	var mp = unsafeWindow.angular && unsafeWindow.angular.element("message-pane");
 	var ct = mp && mp.controller && mp.controller("messagePane");
  if (ct) {
    var cp = ct.constructor.prototype;
    if (cp.initialize.patched) {
      console.log(prefix+"patch already applied");
    } else {
      var oldinitialize = cp.initialize;
      var initialize = function() {
        var that = this.wrappedJSObject || this;
        if (that.context === '') return;
        oldinitialize.call(that);
      }
      initialize.patched = 1;
      cp.initialize = exportFunction(initialize, cp);
    	console.log(prefix+"patch applied");
 	 }
	} else {
  	setTimeout(loop, 1000);
  }
})();