I believe this is from the Prophet ﷺ, who said, "I saw in my dream that I shook a sword and its upper part broke off. That represented what befell the believers on the day of Uhud. Then I shook it again, and it returned better than it was before. That represented the victory Allah brought about and the gathering together of the believers."
حدثنا محمد بن العلاء حدثنا أبو أسامة عن بريد بن عبد الله بن أبي بردة عن جده أبي بردة
أراه عن النبي ﷺ قال رأيت في رؤياي أني هززت سيفا فانقطع صدره فإذا هو ما أصيب من المؤمنين يوم أحد ثم هززته أخرى فعاد أحسن ما كان فإذا هو ما جاء الله به من الفتح واجتماع المؤمنين