All actions at law or in equity pending in any court in favor of or against any village or city of the second class annexed under section 16-122 at the time such annexation takes effect shall be prosecuted by or defended by the city of the first class. All rights of action existing against any village or city of the second class annexed under section 16-122 at the time of such annexation or accruing thereafter on account of any transaction had with or under any law or ordinance of such village or city of the second class may be prosecuted against the city of the first class.